0

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:

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.

Community
  • 1
  • 1
Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88
  • Do you have any circular references in the object that pickle is trying to dump? – Ye Liu Jun 18 '13 at 16:03
  • Not that I'm aware of. This happens when I call client = suds.client.Client(url), so it's happening inside the library code itself. I was looking at the raw WSDL "code" too, but I'm not familiar enough with SOAP to know what to look for. – Mike Driscoll Jun 18 '13 at 18:28

2 Answers2

3

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

Gordon Burgett
  • 1,482
  • 11
  • 15
2

Alternatively if you know you are working with a .NET WCF service you can just change your .svc?wsdl to .svc?singleWsdl and the WCF server will take care of the recursion for you.

DavidG
  • 331
  • 3
  • 7