Unless you’re one of those annoying people who never makes a mistake, the time will come when your java web application is choking on it’s web messages and you just don’t know why. When that time comes, one of things that you will really want to see are the raw messages going back and forth. Which may be a bit problematic if your tools have been hiding the raw messages from you.
When I find myself there, I like to set up a debugging proxy (an explicit proxy will also work). This is as easy as specifying a couple of system properties (http.proxyHost and http.proxyPort) on the command line. Here I show my Java web services message client using Fiddler as a debugging proxy.
1 | 1 $ java -classpath $AXISCLASSPATH -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8888 Simple < data/echo.xml <?xml version="1.0" standalone="yes" ?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/xsd"> <soap:Body> <ns1:echoString> <ns1:echoStringRequest>Hello World</ns1:echoStringRequest> </ns1:echoString> </soap:Body> </soap:Envelope> Invoking http://stephan-desktop/axis/services/echo <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <ns2:echoStringResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://soapinterop.org/xsd"> <return xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Hello World</return> </ns2:echoStringResponse> </soapenv:Body> |
Producing the following view in Fiddler.
By selecting the “View in Notepad” button, we can see the complete response from the web service (formatted below for readability):
1 | <?xml version="1.0" encoding="utf-8"?> |