Java Tutorial - Java Scipt :
Monitoring TCP/SOAP Messages
Apache Axis comes with a nice tool called the Axis TCP Monitor. Using the Axis TCP Monitor, it is possible to trace TCP communication during a Java Web service call. Because SOAP runs on HTTP over TCP/IP, the SOAP messages can be seen as well
.
The TCP Monitor is included in axis.jar. We’ll use port 9080 as the debugging port. So to trace a message, have the client use port 9080. The server will still be listening on port 8080. Because TCP Monitor acts as a proxy, it will
send traffic that it sees on 9080 through to 8080.
Normally, TCP Monitor is a passive listener that just displays the traffic. However, with the resend command, you can actually modify a request. Just edit the text of the request on the left or top window, depending on your layout,
and then hit the Resend button to resend it to the server and see how it behaves.
The command for running TCP Monitor is:
java –classpath axis.jar org.apache.axis.utils.tcpmon 9080 localhost 8080
In the previous example, we specified three parameters: the port to listen on, the host to forward to, and the port to forward to. If you launch the application without any command-line parameters, TCP Monitor will present a GUI interface for specifying the settings.
To see it in action, launch the TCP Monitor with port 9080 as the source and localhost, port 8080 as the destination. Then, try calling the SimpleShop Web service by opening the following URL:
You should see TCP Monitor capture the traffic and display it in the application
This is great for gaining insight into the SOAP conversation. It is also a fantastic tool in its own right for debugging any type of TCP communication, such as servlets or JSPs.
