Sample 430: Callout Mediator for Synchronous Web Service Invocations
<definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
<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/>
</sequence>
</definitions>
Objective
Demonstrate the usage of the callout mediator for making synchronous (blocking)
Web service calls during mediation
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. Then using the send mediator, the message
is sent back to the client. As a result there is no need to define any endpoints
in this configuration.
Invoke the client as follows.
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/
Back to Catalog