This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Info
titleImportant

Reliable Message only works with Nhttp configuration.


Objective: Demonstrate the message exchange between ESB and the server using WS-ReliableMessaging 1.1 Specification (WS-RM).This sample is similar to sample 101 except it uses the RM 1.1 for the communication.

Code Block
languagehtml/xml
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <in>
        <RMSequence single="true" version="1.1"/>
        <send>
            <endpoint name="reliable">
    		<address uri="http://localhost:9000/services/ReliableStockQuoteService">
	   	    <enableRM/>
		    <enableAddressing/>
                </address>
            </endpoint>
        </send>
    </in>
    <out>
        <header name="wsrm:SequenceAcknowledgement" action="remove"
                xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
        <header name="wsrm:Sequence" action="remove"
                xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
        <header name="wsrm:AckRequested" action="remove"
                xmlns:wsrm="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
        <send/>
    </out>
</definitions>

Prerequisites:

  • Deploy the ReliableStockQuoteService in the sample Axis2 server by switching to the samples/axis2Server/src/ReliableStockQuoteService directory and running ant.
  • Start the sample Axis2 server on port 9000.
  • Start ESB with the sample configuration 102 (i.e. wso2esb-samples -sn 102).

In the above configuration, WS-RM is engaged to the endpoint using the <enableRM/> tag. It is possible to engage WS-RM to both Address and WSDL endpoints using this tag. In addition to the RM enabled endpoint, RMSequence mediator is specified before the send mediator. This mediator is used to specify the set of messages to be sent using a single RM sequence. Also it specifies the RM version. In this sample it is specified as single message per sequence. It also specifies the version of the WS-RM to be used. RM related SOAP headers are removed from the message in the out mediator as WS-RM message exchange happens only between the ESB and the server. Now run the sample client using the following command.

Code Block
ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280

You can observe the client output displaying the quote price for IBM as follows:

Code Block
[java] Standard :: Stock price = $189.2521262517493

You can observer the set of messages exchnaged between ESB and back end service using a tool like TCPMon.