Search code examples
pythonloggingpysimplesoap

Cannot get any log information from pysimplesoap


I'm trying to use pysimplesoap (v.1.10) and getting what appears to be some kind of parsing error when executing a method request.

Stripped down version:

import pysimplesoap

soapURL = "https://site/path/to/soap"
namespace = "https://site/path/to/ns"

soapClient = pysimplesoap.client.SoapClient(location=soapURL + "?wsdl",namespace=namespace)

response = soapClient.getDocumentContent('1234567')

(python 2.7.8 btw)


Results in an error:

Traceback (most recent call last):
  File ".\SOAPtest2.py", line 60, in <module>
    response = soapClient.getDocumentContent('1234567')
  File "build\bdist.win32\egg\pysimplesoap\client.py", line 139, in <lambda>
AttributeError: 'str' object has no attribute 'call' 

However, the real question I have is that I am trying (unsuccessfully) to get logging working, but cannot see any output or determine/confirm what the XML structure it is sending/receiving. I might be able to diagnose the problem if I could see what it is receiving/trying to parse.

I have a gist of the code and the error I'm getting as well.

The odd part is that in my original script (before I stripped down to just some test code) I had a secondary logging instance and file handler and it worked just fine. So it seems specific to the pysimplesoap logging.

Any help would be greatly appreciated.


EDIT: Solution

Per KenK's recommendation, I modified my method call to be (documentId='1234567') and it worked. The script got past that error and I got a few log/debug lines in output. It seems that pysimplesoap simply has so few log/debug lines that none were reached prior to the error I was hitting.


Solution

  • Add the following code to your code:

    import logging
    
    logging.basicConfig(level=logging.DEBUG)
    

    To fix the error you're getting, you need to specify an attribute name. Like this:

    response = soapClient.getDocumentContent(name='1234567')
    

    Replace name with whatever's defined for this function.