Debugging AtomAPI implementations
Quick start:
- Download tcpmon.jar
- java -jar tcpmon.jar 8003
- Download and unzip wxAtomClient_25Aug2003.zip
- Replace atomClientAPI.py
- SET http_proxy=http://127.0.0.1:8003/
- python wxAtomClientApp.py
Now that you are up and running, some more information on what you should be seeing.
When debugging HTTP applications, it is helpful to be able to see all the traffic that goes back and forth. To assist with the development of Apache Axis, tcpmon was created. Among other things it can act as a proxy, and in the process it will capture, timestamp, and display all requests and responses.
Python's urllib is protocol independent, and has proxy support. Unfortunately, it's HTTP support is limited, requiring wxAtomClient to frequently drop down to the lower level httplib. Fortunately, adding proxy support for HTTP is fairly easy:
def getConnection(server, port, verb, url, xml, headers): import os if os.environ.has_key('http_proxy'): url=urlparse.urljoin(('http://%s:%d' % (server,port)),url) proxy=urlparse.urlparse(os.environ['http_proxy'])[1].split(':') server=proxy[0] port=(len(proxy)>1) and int(proxy[1]) or 80 conn = httplib.HTTPConnection(server,port) conn.request(verb, url, xml, headers) return conn
Independent of the monitoring usages, proxy support is a valuable thing to have in an HTTP client.
Fun things to explore: the Save and Resend button. You can even edit the request before resending. The Content-Length header will automatically be adjusted.