How to monitor messages using tcpmon in Axis2 dual channel web service invocation

Apache Axis2 client API provides the necessary methods to utilize a service using two transport channels. You can even send request through one transport (e.g:- HTTP) and get the response back via a different transport such as TCP.

setUseSeperateListener(boolean) method of org.apache.axis2.client.Options
class can be used to utilize a separate listener for your response.
If two separate HTTP transport channels are used for request and response, Axis2 starts a new HTTP listener at the client side to receive the incoming response message.

As most of web service developers know, Apache tcpmon can be used to monitor message flow between web service invocations. In one way messaging, it is quite straightforward.
You just need to configure tcpmon to listen in some port and direct the messages to the port where the web service is hosted. In client, port of the endpoint reference has to be changed to tcpmonitor listen port. That's all you have to do for monitoring messages in single channel invocation.

In this post, you can see how tcpmonitor is configured to use in dual channel invocation.

1. If you have not done it yet, download Apache tcpmon from here
Unzip the downloaded file and run build/tcpmon.bat {sh}

2. As I stated before, Axis2 starts a http listener at the client in dual channel invocation. Therefore, you need to configure Axis2.xml to redirect messages to tcpmon as follows.

Open AXIS2_HOME/conf/axis2.xml and locate to the following section.

<!-- ============================================ -->
<!-- Transport Ins -->
<!-- ============================================ -->
<transportReceiver name="http"
<parameter name="port">8080</parameter>
<!-- Here is the complete list of supported parameters (see example settings further below):
port: the port to listen on (default 6060)
hostname: if non-null, url prefix used in reply-to endpoint references (default null)
<parameter name="hostname">http://localhost:8090</parameter>
<!-- <parameter name="originServer">My-Server/1.1</parameter> -->

3. Note the highlighted elements in the above axis2.xml configuration. First you have to uncomment the hostname paramter <parameter name="hostname"> and specify a port which is not already listened in your system (e.g:- 8090).

In tcpmon, create a new listener with 8090 as the listen port and 8080 as the target port. With this configuration, the response messages receive to the reply-to endpoint reference are directed to 8090 tcpmon port and then those will be targeted to client HTTP listener port, 8080.

Now, you should be able to monitor the response flow in dual channel invocation.


Unknown said…

Good post. I've got a slightly different approach: I've blogged it too.
rajika said…
Thanks for the great post machang!
stickerz said…
thanx aiya. much understandable.
Unknown said…
Your solution for a tricky problem also works for the Membrane SOAP Monitor.
Unknown said…
Hi Charitha,
---I am stuck with this---
I am trying to monitor the soap msgs using tcpmon and the transport layer used is HTTPS. I could see the soap request but for response it throws the following error
Exception in thread "main" org.apache.axis2.AxisFault: The server localhost failed to respond with a valid HTTP response
at org.apache.axis2.AxisFault.makeFault(
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(
at org.apache.axis2.transport.http.HTTPSender.send(
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
at org.apache.axis2.engine.AxisEngine.send(
at org.apache.axis2.description.OutInAxisOperationClient.send(
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
at org.apache.axis2.client.OperationClient.execute(
at tutorial.rampart.client.SecureServiceStub.add(
at tutorial.rampart.client.SecureServiceCGClient.main(
Caused by: org.apache.commons.httpclient.ProtocolException: The server localhost failed to respond with a valid HTTP response
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(
at org.apache.commons.httpclient.HttpMethodBase.readResponse(
at org.apache.commons.httpclient.HttpMethodBase.execute(
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(
at org.apache.commons.httpclient.HttpClient.executeMethod(
at org.apache.commons.httpclient.HttpClient.executeMethod(
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(
... 9 more

could you please tell me how to set the transport receiver for https?

Thanks in advance
Charitha said…
Hi asi,
As far as i know, you can't monitor https traffic using tcpmon. You could do this using WSO2 WSAS soap tracer component if your service is deployed on WSAS. Please download WSO2 WSAS from and enable soap tracing. I do not know any other tool which can be used to monitor HTTPS traffic.

Unknown said…
Hi Charitha -

I'm trying to use the Eclipse TCPMON plugin to monitor WebDAV requests to WAS7 (port 9080). I've tried several different Listener ports but always get "Waiting for Connection".
Any suggestions?


- Dave Levitt
Thank you dear

This is a vital news how to use the tcpmon tool.

I also tried or checked different blogs or sites to get an idea how to run it and track the SOAP message,but everybody is telling only the root area but you are genius you just told only 2 points, but it was a good points..

What I done. To Track SOAP Message using Axis2 , Webservice client.
1. dowloaded the tcpmon "tcpmon-1.0-bin" file from the site (you can google it for download with the file name, only 251KB size.
2. Extracted the rar file.

From here to down only for the users who use the web service client in Axis2.
3. In My application (same for all),
3.a. If you are not passing any ConfigurationContext as parameter while creating your stub object, that means you are using the internal axis2.xml only can find it in WebContent\WEB-INF\conf
3.b. if you are passing an instance of Configuration context object while creating you stub object , that means you are using the axis2.xml from your external Axis2 folder only, that you can fine in your "axis2-1.2\conf" location.

4. Find the location where the tag
then give the command tcpmon.bat(windows) or
it will open a tcpmon window
choose the admin tab.

give any port address like 9090 or any port that address should be free in your system to the listener port.

listner option , give the target host name (the same what you are calling in your webservice client for to perform the action)
ex: - in my case location :
Target hostname = and Target Port is = 443

then click ADD button, will create a new window with listening to 9090 and the server location is with port 443.

6. Then back to the Axis2.xml file , give the same


7. then edit your end point address in your client call like
existing one :
new one :
wen ever you perfom the operation the axis2.file will convert the call to htt:// mean while the tcpmon will get your request also.

8. in that created new tab you can see you SOAPMeddage Request/Reponse.

hop this will help you ..for more details mail me..i will be here to help you ..
email :

Popular posts from this blog

Common mistakes to avoid in WSO2 ESB - 1 - "org.apache.axis2.AxisFault: The system cannot infer the transport information from the URL"

Working with HTTP multipart requests in soapUI

How to configure soapUI to send HTTP chunked encoded requests