Python肥皂水“;RuntimeError:调用Python对象时超出了最大递归深度;
我试图使用pythonsuds使用soapweb服务,但得到了错误“RuntimeError:调用Python对象时超过了最大递归深度” 根据跟踪,在第69行的“suds/binding/multiref.py”处存在无限递归 我尝试访问的web服务是 我尝试访问的方法是loadPathwayForId 下面是我的代码中使用web服务的部分:Python肥皂水“;RuntimeError:调用Python对象时超出了最大递归深度;,python,web-services,soap,recursion,suds,Python,Web Services,Soap,Recursion,Suds,我试图使用pythonsuds使用soapweb服务,但得到了错误“RuntimeError:调用Python对象时超过了最大递归深度” 根据跟踪,在第69行的“suds/binding/multiref.py”处存在无限递归 我尝试访问的web服务是 我尝试访问的方法是loadPathwayForId 下面是我的代码中使用web服务的部分: from suds.client import Client client = Client('http://www.reactome.org:8080/
from suds.client import Client
client = Client('http://www.reactome.org:8080/caBIOWebApp/services/caBIOService?wsdl')
pathway = client.service.loadPathwayForId(2470946)
我不确定是什么导致了无限递归。我试图查找这个问题,有报道说肥皂水和无限递归存在问题,但跟踪与我的不同(递归代码不同),因此我怀疑我的问题有其他根源
完整跟踪:
File "C:\Python27\lib\suds\bindings\multiref.py", line 69, in update
self.update(c)
File "C:\Python27\lib\suds\bindings\multiref.py", line 69, in update
self.update(c)
...
File "C:\Python27\lib\suds\bindings\multiref.py", line 69, in update
self.update(c)
File "C:\Python27\lib\suds\bindings\multiref.py", line 69, in update
self.update(c)
File "C:\Python27\lib\suds\bindings\multiref.py", line 67, in update
self.replace_references(node)
File "C:\Python27\lib\suds\bindings\multiref.py", line 80, in replace_references
href = node.getAttribute('href')
File "C:\Python27\lib\suds\sax\element.py", line 404, in getAttribute
prefix, name = splitPrefix(name)
File "C:\Python27\lib\suds\sax\__init__.py", line 49, in splitPrefix
if isinstance(name, basestring) \
RuntimeError: maximum recursion depth exceeded while calling a Python object
提前感谢您的帮助 经过更多的测试,似乎(不幸的是)suds难以解释序列化为XML的Java集合对象。我最终使用SOAPpy来避免这个问题。如果有人能提出解决方案,那就太棒了!与SOAPpy相比,我非常喜欢suds的其他优点。我尝试了很多suds版本和分叉,最终找到了一款可以与代理、https和认证服务一起使用的,请在此处查找: 此外,下面是显示简单用法的示例代码:
from suds.client import Client
# SOAP WSDL url
url = 'https://example.com/ws/service?WSDL'
# SOAP service username and password for authentication, if needed
username = 'user_name'
password = 'pass_word'
# local intranet proxy definition to get to the internet, if needed
proxy = dict(http='http://username:password@localproxy:8080',
https='http://username:password@localproxy:8080')
# unauthenticaded, no-proxy
# client = Client(url)
# use a proxy to connect to the service
# client = Client(url, proxy=proxy)
# no proxy, authenticathed service
# client = Client(url, username=username, password=password)
# use a proxy to connect to an authenticated service
client = Client(url, proxy=proxy, username=username, password=password)
print client
请复制粘贴完整代码回溯