All docs This doc
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 3 Next »

The objective of the sample is to introduce Message Translator Enterprise Integration Pattern (EIP) can be implemented using WSO2 ESB.  Translator will basically change the context of a message from one interface to the other so that the message passed will adhere to the message context rules of the back end service.  

Prerequisites
  • Start the Synapse configuration numbered 0: for example, wso2esb-samples -sn 1007.
  • Start two instances of the Axis2 server and deploy the SimpleStockQuoteService if not already deployed.

Request Structure

The following describes a sample structure of a request which will be sent to the ESB from the client end. The client sends a HTTP REST call in the the following manner

curl -v http://127.0.0.1:8280/stockquote/view/IBM

The message passed can be viewed from TCPMon and it will be smiler to the following structure

GET /stockquote/view/IBM HTTP/1.1 
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 
Host: 127.0.0.1:8281 
Accept: */* 
<!-- Message Translator-->
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <api name="MessageTranslate" context="/stockquote">
        <resource uri-template="/view/{symbol}" methods="GET">
               <inSequence>
             <payloadFactory>
               <format>
            <m0:getQuote xmlns:m0="http://services.samples">
                <m0:request>
                    <m0:symbol>$1</m0:symbol>
                </m0:request>
             </m0:getQuote>
               </format>
           <args>
            <arg expression="get-property('uri.var.symbol')"/>
           </args>
         </payloadFactory>
          <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/>
            </endpoint>
        </send>
        </inSequence>
        <outSequence>
            <send/>
           </outSequence>
    </resource>     
    </api>        
</definitions>

 

 

 

 

 

 

 

 

 

 

  • No labels