The content in this documentation is for older versions of WSO2 products. For updated information on Enterprise Integration Patterns, go to the latest Micro Integrator documentation. "> The content in this documentation is for older versions of WSO2 products. For updated information on Enterprise Integration Patterns, go to the latest Micro Integrator documentation.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Next »

This section explains, through an example scenario, how the Document Message EIP can be implemented using the WSO2 ESB. The following topics are covered:

Introduction to Document Message

The Document Message EIP is used to reliably transfer a data structure between applications. The Command Message EIP allows you to invoke only a specific client through the ESB, while the Document Message EIP sends the entire data unit to the receiver. For more information, see http://www.eaipatterns.com/DocumentMessage.html.

Figure 1: Document Message EIP

Example scenario

This example demonstrates how the ESB transmits an entire message from a client to a sample Axis2 server as a document message. Then the Axis2 server processes the message and identifies which operation to invoke.

The following diagram depicts this process.

Figure 2: Example scenario of the Document Message EIP

Before digging into implementation details, let's take a look at the relationship between the example scenario and the Document Message EIP by comparing their core components.

Document Message EIP (Figure 1)Document Message Example Scenario (Figure 2)
SenderStock Quote Client 
Document MessageProxy Service
ReceiverSimple Stock Quote Service

The ESB configuration

Given below is the ESB configuration for simulating the example scenario explained above. 

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <proxy name="DocumentMessageProxy" transports="https http" startOnLoad="true" trace="disable">
      <target>
         <inSequence>
            <send>
               <endpoint>
                  <address uri="http://localhost:9000/services/SimpleStockQuoteService" />
               </endpoint>
            </send>
         </inSequence>
         <outSequence>
            <send />
         </outSequence>
      </target>
   </proxy>
</definitions>

The configuration elements

Let's investigate the elements of the configuration in detail.

  • Proxy Service - The proxy service takes requests and forwards them to the back-end service, abstracting the routing logic from the client. In this example scenario, the proxy service just forwards requests to the back-end service following the Document Message EIP style. 

Simulating the example scenario

Now, let's try out the example scenario explained above.

Setting up the environment

You need to set up the ESB, and the back-end service:

  1. Download the Document-Message_1.0.0.zip file, which includes the ESB configuration described above. 
  2. See Setting up the Environment for instructions on setting up the ESB and the back-end service.

Executing the sample

Send the following request to the ESB, by using a SOAP client: Note that the entire request will be passed to the back-end Axis2 Server, and the client will receive the response in return.

Request command: 

ant stockquote -Dtrpurl=http://localhost:8280/services/DocumentMessageProxy

Analyzing the output

Stock Quote Client output: 

Standard :: Stock price = $72.78678053494932

Axis2 server console output:

samples.services.SimpleStockQuoteService :: Generating quote for : IBM

  • No labels