Thursday, June 15, 2006

TCPMon

I try to stay away from overly geeky subjects on this blog (no, really...) but sometimes true perfection has to be recognised.

As I do more and more design and development of solutions using web services (SOAP/HTTP, in particular), I find myself wanting to see exactly what is flowing over the wire. (That's code for: getting interoperability to work isn't always trivial....)

The number of times I've been saved by a groovy little tool called TCPMon is large. What's more, almost nobody knows about this tool.... until I tell them.... and then they can't get enough.

So, what is it? It's nothing more than a little app that listens for TCP requests on one port, dumps what it gets, forwards the data (unchanged) to a TCP port at another (or the same) machine and then dumps what comes back, before returning it to the original client... i.e. it's a proxy that dumps the traffic.

So, if you've ever wanted to see the SOAP-ENV or the fault or whatever as it flies over the network, now you can... and you've been able to for ages (since at least WAS 5 - and probably longer since I think there's also an apache version).

How?

If you're running any WebSphere Application Server based product, grab a command prompt and navigate to the lib directory

java -classpath webservices.jar com.ibm.ws.webservices.engine.utils.tcpmon

Tell it which port to listen on (that is where you will subsequently point your client) and which hostname and port to forward the requests to (i.e. the "real" server) and off you go. Fab!

Note: the "ws" in the package name makes me suspect this isn't actually a supported part of the product so don't blame me if it doesn't work for you and don't even *think* of pretending that my mentioning it gives you the right to raise a PMR :-)

6 comments:

LeeChee said...

At last!!!! Some real technical content in your blog, to counter all that salesy/analysty rubbish ;)

tcpmon is a tool I couldn't have lived without over the past couple of years. Back in the days when a SOAP payload was a mystical and rarely-seen beast, this tool was like an X-Ray machine!

And if you needed a more compelling reason to use it, consider this: It is available as a fully integrated component in Rational Application Developer (RAD)-based tooling (WebSphere Message Broker toolkit, WebSphere Integration Developer - think WESB & WPS)...

Don't be scared by Rich's command-line gubbins. Go to Window->Preferences->Internet->TCP/IP Monitor, configure and start your monitor. You won't see anything until your monitor intercepts some traffic - but after that you are in tcpmon heaven. All integrated into your RAD shell, too - lovely!

Richard Brown said...

Cool! I didn't know you could do that.... even better.

Still.... nothing beats shouting across a busy office asking: "can you remember what the fully qualified class name for tcpmon is?!"

Adrian Spender said...

It is indeed an essential tool for any work with Web Services. It originally comes from the Axis 1 stack, and those without WAS can download Axis and run it using java -classpath c:\axis-1_1\lib\axis.jar org.apache.axis.utils.tcpmon for example.

Richard Brown said...

Thanks Adrian.... I knew it was there somewhere :-)

andyp said...

Have to agree with Lee that something as nuts-and-bolts as this is long overdue.

tcpmon is great, and as Lee notes the fact that it is tightly integrated into our tools makes it particularly nice.

The other tools I recommend for testing web services are the Web Services Explorer in RAD, and nettool (which isn't part of our toolset, but can be useful)

Richard Brown said...

Hurrah! I had occasion to use TCPMon again today so thought I'd try Lee's suggestion. What would you know? It works!