TCP Transport

This document will explain how to send and receive SOAP Messages via TCP in Axis2.

Send your feedback or questions to: axis-dev@ws.apache.org. Prefix subject with [Axis2]. To subscribe to mailing list see here.

Content

Introduction

Axis2 supports TCP as a transport. It has support for both send and receive SOAP Messages via TCP. TCP transport does not have any application level headers and the SOAP Message that is sent should be self contained. This makes the interaction fast and simple. However, since there are no application headers, it does not have the privilege of having request URI, and Service dispatching should be done by an alternative method. Thus, RequestURIBasedDispatcher can not be used. The following are the two main alternatives available for dispatching in the Axis2 environment:

  1. Use the name space URI of the first child element of SOAPBody. (SOAPMessageBodyBasedDispatcher).
  2. Enable WS-Addressing. In the case of version 1.1 release Addressing is default (SOAPActionBasedDispatcher).

When the TCP request is sent it is the user's responsibility to use either Addressing or SOAP body base mechanism.

How to Start the TCPServer

The TCP server can be started by running the class org.apache.axis2.transport.tcp.TCPServer with two parameters - repository and port number, as arguments. This class needs all the Axis dependency jars in the classpath. New services can be added in the usual way by dropping the archives to the repository (See User's Guide for more information)

How to Send SOAP Messages Using TCP Transport

TCP transport can be enabled easily from the call API. The following code segment demonstrates how it can be done.

OMElement payload = ...
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(targetEPR);