How to display outcoming and incoming SOAP message for ZSI.ServiceProxy in Python (version 2.1)?

StackOverflow https://stackoverflow.com/questions/3676409

  •  01-10-2019
  •  | 
  •  

Question

Couple months ago I have asked the same question but in the context of older version of ZSI (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 :-)

Was it helpful?

Solution

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

alt text

OTHER TIPS

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top