Sample 431: Callout Mediator with WS-Security for Outgoing Messages
<definitions xmlns="http://ws.apache.org/ns/synapse">
<localEntry key="sec_policy" src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
<sequence name="main">
<callout serviceURL="http://localhost:9000/services/SecureStockQuoteService"
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]"/>
<enableSec policy="sec_policy"/>
</callout>
<respond/>
</sequence>
</definitions>
Objective
Demonstrate the usage of the Callout mediator for making synchronous (blocking)
Web service calls to invoke secured services during mediation.
Executing the Client
In this sample, the Callout mediator does the service invocation to the Secured service
SecureStockQuoteService by encrypting the client request according to the defined policy.
And then received encrypted message is decrypted and after removing the wsse:Security header,
the message is sent back to the client using the send mediator.
Callout Mediator is configured to enable WS-Security as per the policy specified by 'policy_3.xml'.
Invoke the client as follows.
ant stockquote -Dtrpurl=http://localhost:8280/
Back to Catalog