Sunday, June 27, 2010

Axis2 TCP Transport Revamped

I recently did some major improvements to the Axis2 TCP transport. The TCP transport enables Axis2 services and clients to send/receive SOAP messages over TCP, using Java TCP sockets. The old TCP transport was very simple and it must be configured globally in the axis2.xml file. Due to this limitation, a service could not open up its own port to listen to incoming TCP messages. All the TCP requests were captured by a single, globally configured port and WS-Addressing headers were used to dispatch the requests to the appropriate services.
The new transport implementation is fairly advanced with a wide range of configuration options. It can be configured globally in the axis2.xml file, or it can be configured at the service level in the corresponding services.xml files. Only the port number was configurable in the previous TCP transport implementation. The new implementation supports all the parameters described below:
  • transport.tcp.port - Port number (mandatory parameter)
  • transport.tcp.hostname - The host name to which the server socket should be bound
  • transport.tcp.backlog - The length of the message back log for the server socket (defaults to 50)
  • transport.tcp.contentType - Content type of requests (defaults to text/xml)
In the new transport, if a request is received by a port configured at the service level, it is pre-dispatched to the corresponding service. If the global port receives a TCP message, WS-Addressing headers will be looked up while dispatching.
These improvements are now available in the Axis2 trunk. So feel free to take it for a ride and give us your feedback. I also have some plans to make some improvements to the Axis2 UDP transport. I intend to add multicast support to the existing UDP transport and with that we will be able to support multicast request – unicast response message exchange pattern in Axis2.

3 comments:

未命名 said...

Hi! Hiranya Jayathilaka:

I have some difficulties about Axis2 TCP Transport, Would you do me a favour?

Following the TCP transport guide(http://ws.apache.org/axis2/1_2/tcp-transport.html), I can deploy the service, and the tcp endpoint is ok(i can check it in WSDL).

In axis2.xml i comment out the "tcp" transport sender, and the "axis2-transport-tcp-1.0.0.jar" and "addressing-1.5.1.mar" is also in the lib.

But the error:
Exception in thread "main" org.apache.axis2.AxisFault: The system cannot infer the transport information from the tcp://localhost:6060 URL.
at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:82)
at org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:304)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:180)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
at userguide.clients.TCPClient.main(TCPClient.java:55)

I start a thread in wso2 forums:http://wso2.org/forum/thread/10865
wpengyi@gmail.com

Hiranya Jayathilaka said...

Looks like the TCP sender is not enabled in the client axis2.xml. Please check the client side axis2.xml used by your client application.

Cecy said...

I configured the tcp transport in wso2 3.0.1. But I don't know how could be the endpoint to send messages to the local socket ... something like tcp://localhost:2004. The socket is just a waiting for a conecction on port 2004.