Overview Screenshots Download Quick Start Tutorials F.A.Q. Contact     



WorkShop n°6 : Debugging a web service client program

In this workshop we are going to monitor and debug a very simple webservice client program.
The web service is a free online webservice capable of returning the country of a given ip adress. The client is a java client generated with Eclipse.


1- First, let's generate our client code (if you already have a client go to step 2)
Here we suppose that you already have an Eclipse JEE installed with a jee server (for example Tomcat is installed and added in Eclipse).
In Eclipse menu, choose new Projet | Web Service Client.
Choose your jee server and your Web service stack. Here, we choose default eclipse runtime : Apache Axis. Enter the service definition url (WSDL) : 'http://www.ecubicle.net/iptocountry.asmx?WSDL' and let eclipse generate the code for you.

Now, let's create a client code like this one in order to instantiate the generated proxy class :

2- You can run it and check and the web service is responding.

Now, let's set up your java program to use TcpCatcher proxy.

No change in code is required, just add those vm arguments in your Eclispe launch configuration:
-Dhttp.proxyHost=localhost -Dhttp.proxyPort=8200



Start TcpCatcher.
Run client program again, now you can clearly monitor your SOAP conversation because XML is pretty printed and loaded in a treeview
which makes it easy to read.

Of course "someip" is not a valid ip, but for desmonstration purpose we now have a buggy web service call.



Now, lets turn on catch mode and run client program again.
In first packet, we are going to replace "someip" with some valid ip
Note, that Content-Length value is automatically recomputed by TcpCatcher so you don't need to bother about that, you HTTP request will still be correct.

Click on 'Send it ! (and stop catching)'.
The Web Service is now responding with our ip location.