Sample 201: Reliable Communication Between the Client and Proxy Services Using WS-ReliableMessaging

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

Objective

Show case how to engage WS-ReliableMessaging on proxy services so that the communication between client and the proxy service is reliable

Pre-requisites

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

Executing the Client

In the above configuration, a proxy service is created with WS-RM enabled using the <enableRM/> tag. Therefore, this proxy service is capable of communicating with a WS-RM client. It also removes the WS-RM headers in the inSequence before the message is sent to the backend server. This is required as the reliable messaging is applicable only between the client and Synapse. Now start the client with WS-RM as follows:

ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dwsrm=true

In this case, client sends a WS-RM enabled request to Synapse where Synapse sends normal requests to the server. This can be observed by examining the wire level messages between the client and Synapse. These messages would be similar to the wire level messages shown in sample 101.

Back to Catalog