tags:

views:

19

answers:

2

Couple months ago I have asked the same question but in the context of older version of ZSI (http://stackoverflow.com/questions/1497038/how-to-display-outcoming-and-incoming-soap-message-for-zsi-serviceproxy-in-python). Now, in the new version of ZSI 2.1 there is no tacefile parameter). I tried to find a documentation for the new version but I faild. Does anyone know how to display the SOAP messages generated and received by ZSI 2.1? Thank you in advance :-)

A: 

I had this same problem. My workaround was to modify the dispatch.py file that comes with ZSI.

I created a logging function (logmessage) for my app that would store SOAP messages into a database and then added that function where necessary. I do not recall the ZSI version I was using however. You should be able to find these functions pretty easily in the code though. I ave approximate L numbers since i made other edits

in Dispatch.py file in your site-packages directory

L156 - logs SOAP responses

def _Dispatch(tons-of-args, **kw):
     #several lines of code edited here#
     #several lines of code edited here#
     #several lines of code edited here#

     sw = SoapWriter(nsdict=nsdict)
     sw.serialize(result, tc)
     logmessage( str(sw), 1, kw['request'].get_remote_host() ) #LOGGING HERE

L168 - logs SOAP errors

def _ModPythonSendFault(f, **kw):
    logmessage( str(f.AsSOAP()), 1, kw['request'].get_remote_host() )  #LOGGING ADDED HERE
    _ModPythonSendXML(f.AsSOAP(), 500, **kw)

L277 - logs requests

def AsHandler(request=None, modules=None, **kw):
    '''Dispatch from within ModPython.'''
    a = request.read(-1)
    logmessage( a, 0, request.get_remote_host() ) #LOGGING ADDED HERE
    ps = ParsedSoap(a)
    kw['request'] = request
    _Dispatch(ps, modules, _ModPythonSendXML, _ModPythonSendFault, **kw)
JiminyCricket
+1  A: 

For debugging I have found less interfering solution using wireshark to trace the TCP packages. It looks like that:

alt text

czuk
+1 because this is a great (and intended!) use of Wireshark.
jathanism