TCP/UDP Setup Guide

This document explains how to setup the transport sender and listener for TCP/UDP transports required by the samples.

Introduction

Apache Synapse is capable of sending and receiving messages over raw TCP and UDP. Any messages received over these transports can be mediated using the usual set of mediators and can be forwarded over different protocols such as HTTP ans JMS. The transport adapters for TCP and UDP are not available in the Synapse binary distribution by default. This guide will help you to download and setup them in Synapse ESB.

Setting Up the TCP Transport

To enable the TCP transport for Synapse, first you need to download the Axis2 TCP transport jar, and copy it to the 'lib' directory of Synapse. This library can be downloaded from the WS-Commons Transports website. Then open up the axis2.xml file and uncomment the TCP transport receiver and sender configurations.

<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"> <parameter name="port">6060</parameter> </transportReceiver>
<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>

The above configuration enables Synapse to receive raw TCP messages on port 6060. Since no application level headers are available on such requests, Synapse will be solely depending on the addressing headers or the XML payload of the messages to find the target service for TCP requests.

In some of the samples you will have to send raw TCP messages using the sample Axis2 client. In that case you should enable the TCP transport sender for the sample client. This can be done by uncommenting the following entry in the samples/axis2Client/client_repo/conf/axis2.xml file.

<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>

Setting Up the UDP Transport

Enabling the UDP transport for Synapse is similar to enabling the TCP transport. You should download the Axis2 UDP transport jar and copy it into 'lib' directory of Synapse. Then uncomment the following entries in the repository/conf/axis2.xml file to enable the UDP listener and sender.

<transportReceiver name="udp" class="org.apache.axis2.transport.udp.UDPListener"/>
<transportSender name="udp" class="org.apache.axis2.transport.udp.UDPSender"/>

To send UDP messages from the sample client, enable the UDP transport sender for the client in samples/axis2Client/client_repo/conf/axis2.xml file.