This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The Callout Mediator performs a blocking external service invocation 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. Therefore, it 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>
  • source - The element specifies the payload for the request message using an XPath expression or a registry key that will be used.
  • target - The 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 will be attached to the current message context as a property.

UI Configuration

The following properties of the Callout Mediator are available:

General Options of the Callout Mediator
  • 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

It specifies the payload for the request message using an XPath expression or a registry key that will be used. Can be specified as:

  • XPath - Can be chosen from the "Namespace Editor" list.
  • Key - Can be chosen either from Configuration Registry or Governance Registry. Refer to more information about the Registry Browser in Namespace.
Target

It 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 will be attached to the current message context as a property. Can be specified as:

  • XPath - Can be chosen from the "Namespace Editor" list.
  • Key - Can be chosen either from Configuration Registry or Governance Registry. Refer to more information about the Registry Browser in Namespace.

Tip

You can click the "Namespaces" link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor" where you can provide any number of namespace prefixes and the URL used in the XPath expression.

Note

You can configure the Mediator using XML. Click on "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, 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.

  • No labels