2013-08-27 45 views
1

我試圖使用使用Python suds的SOAP web服務,但我收到錯誤「RuntimeError:調用Python對象時超出最大遞歸深度」 。Python suds「RuntimeError:調用Python對象時超出最大遞歸深度」

據跟蹤,還有在「泡沫/裝訂/ multiref.py」,行69

我試圖訪問該Web服務http://www.reactome.org:8080/caBIOWebApp/services/caBIOService?wsdl無限遞歸。

我試圖訪問的方法是loadPathwayForId。

這裏的消耗Web服務我的代碼的一部分:

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 

在此先感謝您的幫助!

+0

複製粘貼完整代碼追蹤,請 – zen11625

回答

0

經過更多測試後,似乎(不幸)suds在解析序列化爲XML的Java Collection對象時遇到問題。我最終使用SOAPpy來避免這個問題。如果有人可以提出修復建議,那就太棒了!我真的很喜歡它的其他優點而不是SOAPpy。

0

我試過很多次使用儀器版本和叉,終於尋得了一個與代理,HTTPS和認證服務工作,在這裏找到:

https://github.com/unomena/suds

而且,這裏是顯示簡單的例子代碼用法:

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:[email protected]:8080', 
      https='http://username:[email protected]: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 
相關問題