Sample 433: Callout Mediator - Invoke a service using a defined Endpoint
<definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
<callout>
<endpoint key="StockQuoteServiceEndpoint"/>
<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>
<endpoint name="StockQuoteServiceEndpoint">
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</definitions>
Objective
Demonstrate how to invoke a service from Callout Mediator using a defined 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 defined endpoint
named 'StockQuoteServiceEndpoint' to send the message to the StockQuoteService.
Invoke the client as follows.
ant stockquote -Daddurl=http://localhost:8280/
Back to Catalog