This documentation is for WSO2 ESB version 4.0.3. View documentation for the latest release.

Sample 0 Introduction to ESB

Objective: Introduction to ESB shows how a message could be made to pass through ESB and logged before it is delivered to its ultimate receiver.

<definitions xmlns="http://ws.apache.org/ns/synapse">
    <!-- log all attributes of messages passing through -->
    <log level="full"/>

    <!-- Send the messageto implicit destination -->
    <send/>
</definitions>

The Stock quote client can operate in the following modes for this example:

Smart Client mode
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/
Using ESB as a HTTP Proxy
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dprxurl=http://localhost:8280/
Gateway Mode / Dumb Client

Refer to Sample 1 Simple Content-Based Routing (CBR) of Messages.

Prerequisites
  • Start the Synapse configuration numbered 0: for example, wso2esb-samples -sn 0.
  • Start the Axis2 server and deploy the SimpleStockQuoteService if not already deployed.
Execute the Smart Client

By tracing the execution of ESB with the log output level set to DEBUG, you will see the client request arriving at ESB with a WS-Addressing To set to EPR http://localhost:9000/services/SimpleStockQuoteService.The ESB engine logs the message at the "full" log level (all the message headers and the body) then sends the message to its implicit To address which is http://localhost:9000/services/SimpleStockQuoteService.You will see a message in the Axis2 server console confirming that the message got routed to the sample server and the sample service hosted at the sample server generating a stock quote for the requested symbol.

Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM

The response message generated by the service is again received by ESB, and flows through the same mediation rules, which logs the response message and then sends it back to the client. On the client console you should see an output similar to the following based on the message received by the client.

Standard :: Stock price = $95.26454380258552
Execute the Proxy Client

You will see exactly the same behavior as per the previous example when you run this scenario. However, this time the difference is at the client, as it sends the message to the WS-Addressing To address http://localhost:9000/services/SimpleStockQuoteService, but the transport specifies ESB as the HTTP Proxy.