1- First lets generate a simple C# client program (if your client is ready go to step2). For demonstration purposes, let’s use this online public web service capable of locating an ip address.
Let’s create a console project, then right click on project name and 'Add Service Reference..' | Advanced |
Add Web Reference
Then copy and paste the url of the service interface definition http://www.ecubicle.net/iptocountry.asmx?wsdl Click Go and 'Add Reference'
At this stage Visual Studio has generated the 'iptocountry' class for us. We just need to instantiate it and call its method FindCountryAsString(..).
Generating a Web Service client is indeed very simple !
Here is our sample client program, make sure it is working
2- Now, just start TcpCatcher (open with java) and run again your C# program. The SOAP communication get monitored, this is as simple as that !
You can enter TcpCatcher debug mode by clicking on “Catch mode” in the main panel. Each SOAP message is intercepted and can be changed before being forwarded.
Suppose now, that you are accessing the internet behind a corporate web proxy that requires a Windows authentication.
Your code should look more like this one (assuming you are retrieving default system proxy settings) :
Check that the program above is working fine. Then, just start TcpCatcher and again the SOAP communication get monitored. This is working because TcpCatcher becomes your default proxy at startup in between Visual Studio and the corporate web proxy and forwards Windows credential handshake. When you close TcpCatcher, your corporate proxy becomes your default proxy again.
If you prefer you could also code it more explicitly that way (and from the TcpCatcher Settings panel you can check that TcpCatcher is forwarding communication to your corporate proxy):