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.
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