This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

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

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation :

  • <PRODUCT_HOME>/ repository/samples/ directory that includes all Integration profile samples is changed to <EI_HOME>/ samples/service-bus/.
  • <PRODUCT_HOME>/ repository/samples/resources/ directory that includes all artifacts related to the Integration profile samples is changed to <EI_HOME>/ samples/service-bus/resources/.

Objective: Demonstrate the use of the Callout mediator for synchronous web service invocations.

 

    <!-- Simple callout  mediator -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <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>
    <property name="RESPONSE" value="true"/>
    <header name="To" action="remove"/>
    <send/>
    <drop/>
</definitions> 

Prerequisites:

  • Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000.
  • Start Synapse with the sample configuration 430 (i.e. wso2esb-samples -sn 430).

In this sample, 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. Then, using the Send mediator, the message is sent back to the client.

Invoke the client as follows.

ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/

  • No labels