Python suds - Recursion error in wsdl.py
Question: I am currently writing a Python script using the suds package to connect to a
new client. When I call suds.Client with the url, I get a recursion error:

    
    
        RuntimeError: maximum recursion depth exceeded while pickling an object
    File "c:\Users\mdriscoll\Documents\projects\test_soap\test_soap.py", line 112, in <module>
      main(sys.argv[1:])
    File "c:\Users\mdriscoll\Documents\projects\test_soap\test_soap.py", line 100, in main
      sendSOAPMsg(agency, fax_id, fax_num, setxid)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\test_soap.py", line 32, in sendSOAPMsg
      client = Client('https://somerandomclient.com/blahblah.svc?wsdl')
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\client.py", line 112, in __init__
      self.wsdl = reader.open(url)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\reader.py", line 152, in open
      d = self.fn(url, self.options)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\wsdl.py", line 157, in __init__
      self.open_imports()
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\wsdl.py", line 202, in open_imports
      imp.load(self)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\wsdl.py", line 314, in load
      d = Definitions(url, options)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\wsdl.py", line 136, in __init__
      d = reader.open(url)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\reader.py", line 80, in open
      cache.put(id, d)
    File "c:\Users\mdriscoll\Documents\projects\test_soap\suds\cache.py", line 336, in put
      bfr = pickle.dumps(object, self.protocol)
    

At first, I thought it was related to the issue mentioned earlier on Stack:

  * [Python suds showing the following issues "RuntimeError: maximum recursion depth exceeded"](http://stackoverflow.com/questions/5742808/python-suds-showing-the-following-issues-runtimeerror-maximum-recursion-depth)

But that is an issue in suds' schema.py. I tried the patch mentioned just in
case, but it has no effect and the logging that was added in the patch is
never called, so I know that is not the issue here.

I am running Python 2.6 on Windows with suds 4.1 beta. Note: the url in the
traceback has been scrubbed since I am not allowed to mention their name.


Answer: I am the developer working on the other side of this web service. There was
indeed a circular reference in the WSDL. I have since fixed that issue and
Mike is no longer seeing the recursion error.

On my side, the service is being built on the .NET framework using WCF. The
issue was due to my attempt to get rid of the <http://tempuri.org> namespace
in the WSDL. I had added the correct Namespace to the ServiceContract,
DataContract, and ServiceBehavior attributes on the appropriate service
classes, but did not know about the bindingNamespace configuration value on
the server endpoint element. This caused Visual Studio to generate two WSDL
files which referenced eachother, one for the elements belonging in the
correct namespace and one for the binding information which was in the
tempuri.org namespace.

I found the following blog post to be extremely helpful:
<http://www.ilovesharepoint.com/2008/07/kill-tempuri-in-wcf-services.html>

