WSO2 ESB : Configure to receive tcp requests

Posted: June 13, 2013 in esb, linux, ubuntu, wso2
Tags: , ,

By default WSO2 ESB is configured to accept HTTP messages. But you can configure ESB to accept TCP requests also.

  • Add the following to the $ESB_HOME/repository/conf/axis2/axis2.xml
<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener" >
</transportReceiver>
  • Create a proxy to accept the requests
    
    <?xml version="1.0" encoding="UTF-8"?>
    <proxy xmlns="http://ws.apache.org/ns/synapse" name="Udara-Tcp"   transports="tcp" startOnLoad="true" trace="disable">
       <description/>
       <target>
          <endpoint>
             <address uri=""/>
          </endpoint>
          <inSequence>
             <log level="full" />
          </inSequence>
          <outSequence>
             <send/>
          </outSequence>
       </target>
            <parameter name="transport.tcp.contentType">application/xml</parameter>
            <parameter name="transport.tcp.port">8280</parameter>
    </proxy>
    

    Note that  the parameter  tcp port is given as 8280 which means it is listening on port 8280.

Advertisements
Comments
  1. cagil says:

    Does the path of axis2.xml must be under the /repository/axis2 folder? I put the axis2.xml configuration under /repository/conf/axis2 folder? Does it make difference?

    WS02ESB gives TCP connection errors and refuses my connectrions. The logs are:

    – Error while starting the TCP endpoint. This service is being marked as faulty and will not be available over the TCP transport…

    Which may cause such a problem?

    • Hi cagil,

      The correct path of the axis2.xml is within /repository/conf/axis2 folder. I have mistyped the path, thanks for pointing it out.

      Could you please check whether another process is running on the port you specified as parameter ‘transport.tcp.port’.

  2. cagil says:

    Hi,

    Thank you for your reply. I solved the TCP endpoint problem. The problem is caused by my wrong configuration. There was more than one <transportReceiver … configuration with same port number within the axis2.xml and axis2_client.xml files. Also, there was two parameter definitions for tcp port; one within the transportReceiver tag and one outside the tag with same port number
    (9090). I changed the port numbers and the error is gone however, I don’t understand the difference between defining a transport receiver within the axis2.xml and axis2_client.xml files. Is it required to define a “transport.tcp.port” parameter outside transportReceiver tag or is it nonsense?

    Another problem is with my new axis2 configuration, my tcp endpoint is created successfully however my tcp messages could not be received. It gives:

    org.apache.axis2.AxisFault: A header representing a Message Addressing Property is not valid and the message cannot be processed..

    errors. Is my soapenvelope format incorrect? Here is my message:

    “tcp://localhost:9090/services/CefStringProxyServicehttp://www.w3.org/2005/08/addressing/noneurn:uuid:7fab0c17-df58-4f71-94ff-162c2a8afb54SendCefEventStringSOME MESSAGE HERE”

  3. Just define the port only in axis2.xml within transportReceiver tag.

    Commenting on the the message processing error, in this exampe I have specified the ‘content-type’ of the message is xml.

    application/xml

    So this expect a xml message to receive. For example after starting the tcp receiver in port 8280 following command will produce a valid request message

    cat ‘file_with_a_xml_content’ | nc localhost 8280.

    Specify the content type according to your message type, the default content type is most probably SOAP.

  4. Raja Ghosh says:

    Hi How can integrate WSO2 esb with weblogic/tomcat?

  5. Idana says:

    An inilnetgelt point of view, well expressed! Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s