This documentation is for WSO2 Enterprise Service Bus version 4.8.0 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

The Callout Mediator performs a blocking invocation of an external service during mediation. The service URL and the optional action specify the parameters for this external call.

As the Callout Mediator performs a blocking call, it cannot use the default non-blocking HTTP/S transports based on Java NIO. Instead, it defaults to using <ESB_HOME>/repository/conf/axis2/axis2_blocking_client.xml as the Axis2 configuration and <ESB_HOME>/repository/deployment/client as the client repository unless these are specified separately.



Syntax

<callout serviceURL="string" [action="string"]>
      <configuration [axis2xml="string"] [repository="string"]/>?
      <source xpath="expression" | key="string"/>
      <target xpath="expression" | key="string"/>
</callout>

UI configuration

To add the Callout mediator to a sequence, click Add Child at the point in the sequence tree where you want to add the mediator, and then choose Advanced -> Callout.

Following are the properties you set for the Callout mediator:

  • ServiceURL - URL of the service you are calling.
  • Action - SOAP action to append to the service call.
  • Axis2 Repository - Full path to Axis2 client repository where the services and modules are located.
  • Axis2 XML - Full path to Axis2 XML configuration file location.
  • Source - Specifies the payload for the request message. You can specify the source as follows:
    • XPath - An expression that defines the location in the message. You can click Namespaces to map namespaces to prefixes that you use in your expression.
    • Key - A registry key in the Configuration Registry or Governance Registry that defines the location of the payload.
  • Target - Specifies the node or property where the resulting payload will be attached to the current message. You can specify the target as follows:
    • XPath - An expression that defines the location in the message. You can click Namespaces to map namespaces to prefixes that you use in your expression.
    • Key - A registry key in the Configuration Registry or Governance Registry that defines the property that will contain the resulting payload and be added to the current message context.

You can also configure the mediator using XML by clicking switch to source view in the Mediator window.

Example

<callout serviceURL="http://localhost:9000/services/SimpleStockQuoteService"
         action="urn:getQuote">
    <source xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
            xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
    <target xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
            xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>

In this example, the Callout Mediator does the direct service invocation to the StockQuoteService using the client request, gets the response, and sets the response as the first child of the SOAP message body. You can then use the Send Mediator to send the message back to the client.

See also Sample 430: Callout Mediator for Synchronous Service Invocation.

 

  • No labels