Sample 434: Callout Mediator - Invoke a service using an inline Endpoint

<definitions xmlns="http://ws.apache.org/ns/synapse"> <sequence name="main"> <callout> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <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> <respond/> </sequence> </definitions>

Objective

Demonstrate how to invoke a service from Callout mediator using an inline endpoint.

Pre-requisites

  • Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
  • Start Synapse using the configuration numbered 434 (repository/conf/sample/synapse_sample_434.xml)
    Unix/Linux: sh synapse.sh -sample 434
    Windows: synapse.bat -sample 434

Executing the Client

In this sample, the Callout mediator does the direct service invocation to the StockQuoteService using the client request, gets the response, and sets it as the first child of the SOAP message body. Callout Mediator uses the inline endpoint to send the message to the StockQuoteService.

Invoke the client as follows.

ant stockquote -Daddurl=http://localhost:8280/

Back to Catalog