Sample 155: Dual Channel Invocation on Client Side and Server Side

<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy"> <target> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"> <enableAddressing separateListener="true"/> </address> </endpoint> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/> </proxy> </definitions>

Objective

Sample 13 show cased how to perform dual channel invocations on the client side. This sample demonstrates how to perform dual channel invocations on both client side and server side, using proxy services.

Pre-requisites

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

Executing the Client

This sample will show the action of the dual channel invocation between client and Synapse as well as between Synapse and the Axis2 server. Note that if you want to enable dual channel invocation you need to set the separateListener attribute to true on the enableAddressing element of the endpoint.

Execute the stock quote client in the dual channel mode as follows:

ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=dualquote

In the above example, the request received is forwarded to the sample service hosted on Axis2 and the endpoint specifies to enable addressing and do the invocation in dual channel mode. If you observe the message flow using TCPmon, you will see that on the channel you send the request to Synapse, the response has been written as HTTP 202 Accepted, where as the real response from Synapse comes over a different channel which cannot be obsesrved unless you use tcpdump to dump all the TCP level messages.

At the same time you can observe the behaviour of the invocation between Synapse and the actual Axis2 service, where you can see a 202 Accepted message being delivered to Synapse as the response to the request. The actual response will be delivered to Synapse over a different channel.

Back to Catalog