Monday, January 7, 2013

Configuring TCP transport in WSO2 ESB for soap12 messages

This will demonstrate how to configure WSO2 ESB TCP transport with soap12 messages.To enable the TCP transport for samples, simply open up the repository/conf/axis2/axis2.xml file in a text editor and add the following transport receiver configuration and sender configuration. TCP transport module is shipped with ESB by default.
 
 <!-- Enable TCP message -->  
   <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">  
     <parameter name="transport.tcp.port">8290</parameter>  
     <parameter name="transport.tcp.contentType">application/soap+xml</parameter>  
   </transportReceiver>  
   <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>  

application/soap+xml is the content type of the soap12 messages and application/soap+xml is the message content type of the server for tcp transport.

once configuration is done. start server. then you can see following log for TCP transport

[2013-01-07 19:27:19,241]  INFO - TCPTransportListener TCP listener started
[2013-01-07 19:27:19,250]  INFO   [2013-01-07 19:27:19,245]  INFO - TCPServer TCP server started on port : 8290

Add following configuration for a proxy service
 
<proxy xmlns="http://ws.apache.org/ns/synapse" name="tcpProxy" transports="tcp" startOnLoad="true" trace="disable">   
    <target>   
     <inSequence>   
      <log level="full"/>   
      <callout serviceURL="http://localhost:9000/services/SimpleStockQuoteService"   
        action="urn:getQuote">   
       <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"   
         xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"   
         xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>   
       <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"   
         xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"   
         xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>   
      </callout>   
      <property name="RESPONSE" value="true"/>   
      <property name="messageType" value="application/soap+xml" scope="axis2"/>   
      <property name="ClientApiNonBlocking" scope="axis2" action="remove"/>   
      <header name="To" action="remove"/>   
      <log level="full"/>   
      <send/>   
      <log level="full"/>   
     </inSequence>   
    </target>   
   </proxy>    

Refer proxy service by
tcp://10.100.3.55:8290/services/tcpProxy?contentType=application/soap+xml









No comments:

Post a Comment