Callout Mediator

The <callout> mediator performs a blocking external service invocation during mediation. The serviceURL and the optional action specifies the parameters for this external call. The source element specifies the payload for the request message using an XPath expression; or a registry key that will be used. The target element specifies a node, at which the resulting payload will be attached into the current message, or the name of a key/property using which the response would be attached to the current message context as a property.

As the callout mediator performs a blocking call, it cannot use the default non-blocking http/s transports based on Java NIO, and thus defaults to using the samples/axis2Client/client_repo/conf/axis2.xml as the Axis2 configuration, and samples/axis2Client/client_repo 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

Figure 1: Callout mediator specific options

Callout mediator specific options,

  • ServiceURL - URL of the service
  • Action - SOAP action
  • Axis2 Repository - Full path to Axis2 Repository Location, This is the place where services and modules are
  • Axis2 XML - Full path to Axis2 XML file location
  • Source - Payload of the message
  • Target - A node to attach the response element

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 scenario, Callout mediator does the direct service invocation to the StockQuoteService using the client request, get the response and set it as the first child of the SOAP message body. Then using the send mediator, the message is sent back to the client.