Go to content Go to sidebar

Browsing the "Web Development" category...

Examining your Java App with a Debugging Proxy

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 $ 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.

Fiddler Capture of a Java web services invocation

By selecting the "View in Notepad" button, we can see the complete response from the web service (formatted below for readability):

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
  <ns1:echoMeStringResponse
      soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
      soapenv:mustUnderstand="0"
      xsi:type="soapenc:string"
      xmlns:ns1="http://soapinterop.org/echoheader/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">header text</ns1:echoMeStringResponse>
  </soapenv:Header>
  <soapenv:Body>
    <ns2:echoStringResponse
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns2="http://soapinterop.org/xsd">
      <return xsi:type="xsd:string">Hello World</return>
    </ns2:echoStringResponse>
  </soapenv:Body>
</soapenv:Envelope>

Using a Debugging Proxy

I’m a strong believer in the power of “View Page Source” in the browser. But that doesn’t get you very far in this era of AJAX and Flash. If you want to see the real action these days, then you need to use a debugging proxy.

On windows, my recommended proxy is Fiddler. Primarily because Fiddler will automatically configure itself as the proxy server for Internet Explorer on startup and automatically remove itself on shutdown. If you use something like Burp, then you’ll need to manually configure the browser proxy server host and port [and more importantly, manually disable the proxy configuration when you’re done]. The downside of this WinINet magic is that you may pick up HTTP requests from any HTML mail you receive in Outlook.

The following image shows the Fiddler results for the Take the First Step home page. The left pane shows all the HTTP requests and the right pane provides detail on the selected request. Skimming down the requests, you can see that I have the Google toolbar installed in IE and that Take the First Step uses MyBlogLog, Google Analytics, and the Radio Userland webbug.

Fiddler Debugging Proxy at work

Of course, there really isn’t anything here at Take the First Step that you couldn’t find just as easily via “Page Info” or “View Page Source”. But I’m confident that you’ll find a visit to your favorite AJAX site quite illuminating.


Apache Tcpmon

I was familiar with tcpmon from Apache Axis distribution. But I had no idea that there was a independent Apache TCPMon. The primary difference between the two seems to be the built in sender screen that allows you to enter a SOAP request, submit the request to a web service, and view the response.

If you work with web services in Java, then it is definitely worth the download. The screen shot below shows the same web service request and response used in my Java Web Services Message Client – the request on top and the response below.

Tcpmon showing Web Service request and Response


Page Rank is Back

My page rank took a big hit when I moved my home url from the blog.ideoplex.com sub-domain to the main ideoplex.com domain back in June. I was beginning to think that it wasn’t going to come back.

I’m sure that it was just a coincidence, but after setting my preferred domain to ideoplex.com in Google’s Webmaster Tools my home page rank rose from 2 to 5. Not quite the 6 that I had before the move, but I was blogging much more frequently back then.

Coincidences aside, I’ve always known that most of my readers come for my Java Tutorials as a result of a Google search. But I’ve never really understood my search terms until now:
ideoplex.com query stats

Thanks go to David Hornik for his post on Google Webmaster Tools


Simon Willison Has Moved

Simon Willison‘s blog has moved to a new domain. A blog move can be rough on your search rankings. Hopefully this link will help out a bit.

Older links to Simon include:


Browsercam for the Little Guy

In an ideal world I could do a standards based CSS design, test it in a single browser, and declare victory. In the real world I do a standards based CSS design, cross my fingers, test in as many browsers as I have installed, and repeat until I’ve reached a reasonable compromise. Which is why a service like BrowserCam is so great – screen captures of the major browser variants on the major OS flavors.

The only problem is that the BrowserCam Service Plans are targeted at commercial users. About a year and a half ago, I asked for an account for the casual user. What I got was just as good – a group purchase via Fundable. Which has been institutionalized as the Fundable BrowserCam Special. Plans designed for the small professional/dilettante with friends.

Which is a roundabout way of me saying that we need just a few more members for Zach’s BrowserCam Group Membership – take 2.


Standalone Comments and Trackback for Radio Userland

I'm pleased to announce the availability of Standalone Comments and Trackback for Radio Userland. This release refactors my previous Standalone Trackback package to support standalone comments. You might be interested in this package if you: host your own Radio Userland weblog, know some perl, and want to improve the performance of your weblog.

Requirements
  • Web Server capable of running cgi scripts
  • Perl with the following Perl Modules:
    • File::Spec
    • Storable
    • CGI
    • CGI::Cookie
    I believe that these are core modules as of Perl 5.6.0.

14 May: Updated to allow comment editing.