Debug SOAP apps

Daily Newsletters

Sign up to ZDNet UK's daily newsletter.

ANALYSIS
One of the most common tasks during application development is debugging. With new tools and new technologies, debugging is essential to understanding what's happening and why your application is behaving as it is. To this end, the Apache Group distributes a nice little application as part of Apache SOAP, the TCP Tunnel/Monitor that you can use to monitor and debug your SOAP interfaces. Note that this application only applies to SOAP implementations that use HTTP as the transport. TCP Tunnel/Monitor
The TCP Tunnel/Monitor application is really just a simple proxy application that includes a visual interface. When you run the application, you specify a host port and a target address and port. TCP Tunnel/Monitor will display a window with two text areas:
  • The text area on the left shows the incoming request, received by the application on the host port you specify.
  • The text area on the right shows the response received from the target server.
You can use the application to monitor servers locally and remotely. If your Web server is local, then you will specify a host port other than the one your Web server is currently using. For example, if you are running Tomcat on port 8080, then you can start the application with the following command: java org.apache.soap.util.net.TcpTunnelGui 8081 localhost 8080 This command runs the TcpTunnelGui class and passes in three parameters:
  • The first parameter specifies the port that the tool will listen on. Your SOAP client will have to be redirected to this port rather than the normal port in order to see things happen.
  • The second parameter is the target address (the local machine in this case).
  • The final parameter is the target port (in this case, where Tomcat is listening).
You can point the monitor at remote servers too. Simply change the target address and port to match the host you want to monitor. For example, to monitor the messages to and from the Google Web service, you can use the following command: java org.apache.soap.util.net.TcpTunnelGui 88 api.google.com 80 In this case, your client's SOAP location is now http://localhost:88/search/beta2 instead of http://api.google.com/search/beta2. SOAP
When you run your SOAP client, it will send a request to the SOAP location you've specified. To use this tool, the SOAP location will be different than the normal location. Each request is proxied by the monitor program, so you will have to change the SOAP location of the service you are calling to be at host localhost and at the port you specified as the host port when starting up the tunnel. For example, if you have an existing Web service client, it may contain some code similar to this: String soaplocation = "http://mywebservice.mydomain.com/soap/servlet/rpcrouter";
URL soapurl = new URL(soaplocation);
You can easily modify this to point to the proxy: String soaplocation = "http://localhost:88/soap/servlet/rpcrouter";
URL soapurl = new URL(soaplocation);
In a real application, the URL is probably not hard-coded in the source but in some externally editable file. In this case, it may make sense to have two parameters in this file -- one that points directly to the service and another that points at the proxy address. Then you could add another file item that indicates if the service is in debug mode and use it to dynamically change where the service client points to, like this Java code snippet: String debugmode = myConfiguration.getProperty("debugMode");
String soaplocation;
if (debugmode.equalsIgnoreCase("YES")) {
   soaplocation = myConfiguration.getProperty("soapLocation");
} else {
   soaplocation = myConfiguration.getProperty("soapLocationDebug");
}
Not just for debugging SOAP
This tool is useful beyond just monitoring SOAP messages. It can be used to monitor any HTTP service as well -- and it's not dependent on Apache Web servers, either. Because the tool is a generic proxy, you can use it to monitor HTTP and SOAP messages to Microsoft IIS servers, Apache Web servers, Tomcat, WebLogic, or any other HTTP server.
For a weekly round-up of the enterprise IT news, sign up for the
Enterpise newsletter. Find out what's where in the new Tech Update with our
Guided Tour. Tell us what you think in the
Enterprise Mailroom.

Post your comment

In order to post a comment you need to be registered and logged in.

You can also log in with Facebook. Log in or create your ZDNet UK account below

  • Login

Will not be displayed with your comment

By signing up for this service, you indicate that you agree to our Terms and Conditions and have read and understood our Privacy Policy. Questions about membership? Find the answers in the Community FAQ

Get ZDNet UK's daily newsletter

Enter your email address to sign up

ZDNet UK Live

JCB33

How dare film makers, artists or anybody that invests in creativity stop us pirating their works for free. I want to be able to walk into my local...

1 hour ago by JCB33 on ACTA stumbles in Germany
Moley

@GrueMaster. I prefer horses for courses rather than one size fits all. I, and I suspect most other computer users, do not really wish to have...

3 hours ago by Moley on A tale of two distros: Ubuntu and Linux Mint
greycynic

The product that scares me every time I have to use it is the Office 2007 version of Excel. The first bug that I found was applying the median...

3 hours ago by greycynic on Ten flawed products that derail productivity
GrueMaster

Nice review and very informative. One thing I'd like to add (in reply to whs001's 1st question), the main reason to have the same interface from...

5 hours ago by GrueMaster on A tale of two distros: Ubuntu and Linux Mint
Frederick Wrigley

I'be been using Mint 12 since the RC came out, and I am far more happy with the Cinnamon, the Mate, and, yes (with extensions), theGnome 3...

6 hours ago by Frederick Wrigley via Facebook on A tale of two distros: Ubuntu and Linux Mint
bdantas

Excellent article. One small correction, though--although a fresh installation of Linux Mint 12 will, indeed, provide the user with a version of...

6 hours ago by bdantas on A tale of two distros: Ubuntu and Linux Mint
Alan Ralph

In related news, the ISPs club together to get the members of the Home Affairs Select Committee (ya goofed on that part, ZDNet UK) copies of "The...

7 hours ago by Alan Ralph via Facebook on MPs urge ISPs to take down terrorist material
Alan Ralph

In related news, the ISPs club together to get the members of the Home Affairs Select Committee (ya goofed on that part, ZDNet UK) copies of "The...

7 hours ago by Alan Ralph via Facebook on MPs urge ISPs to take down terrorist material
Moley

For Gnome 2 die-hards, it is possible to add icons to the bottom panel (or top top panel, if you prefer) which provide the exact Gnome 2...

8 hours ago by Moley on A tale of two distros: Ubuntu and Linux Mint
ramwellian

Your comments would seem pretty naive and immature. Your 'solution' appears to be, "gee, let's all just give in to the hackers and give them...

8 hours ago by ramwellian on Cloud computing security: no more oxymoron?
BugStalker

"Interesting thought ... If you installed Win7 as a dual boot on a machine that previously only had Linux, and it wrecked your Linux installation,...

8 hours ago by BugStalker on Windows 7 Declares War on GRUB
whs001

This is an excellent summary of Ubuntu and Mint and the interface differences between them. Most such articles take a very partisan position for...

8 hours ago by whs001 on A tale of two distros: Ubuntu and Linux Mint
Moley

@ewallace. Not so clear. Anyone can obtain the text, for example from here http://www.ustr.gov/webfm_send/2379. I support ACTA so long as it and...

9 hours ago by Moley on ACTA: Facts, misconceptions and questions
45283

I think WinRT is fantastic. I just wish it was an option for people that didn't want to go through Microsoft's App Store with its attendant...

12 hours ago by 45283 on Why Windows 8 needs architectural hygiene for WOA
Burn-IT

Nine people? £30m? Who's back pocket is that lot going in? And IF they say it is for new buildings, what about all the ones the government has...

13 hours ago by Burn-IT on Police set to launch three £30m e-crime hubs
ewallace

Just to be clear, nobody knows what is in the text of ACTA, here is a photograph of the text of ACTA http://twitpic.com/8h9iju as submitted to the...

13 hours ago by ewallace on ACTA: Facts, misconceptions and questions
fgvrg56

Unfortunately main issue is that ASUS is refusing to accept that they make some mistake on this version of asus Transformer prime. 1 - GPS sensor...

14 hours ago by fgvrg56 on Asus Eee Pad Transformer Prime Wi-Fi & GPS problems?
Ben Woods

@Marcus A fair question. Just talked with Archos which said it was working on an announcement for next week....

15 hours ago by Ben Woods on Archos confirms G9 Ice Cream Sandwich update schedule
Marcus Karlsson

Any update on this, considering the claimed "first week of February"?

16 hours ago by Marcus Karlsson via Facebook on Archos confirms G9 Ice Cream Sandwich update schedule
apexwm

Bill Goodrich : Just as al_langevin pointed out, with Windows Server 2008 there is no Services for Macintosh anymore. It's gone, not available....

1 day ago by apexwm on Windows Server 2008 drops the ball for Mac compatibility