我有一個使用Suds調用SOAP的Web服務(該服務是寫在ASP.net)以下簡單的Python測試腳本:的Python /肥皂水:類型未找到:「XS:複雜類型」
from suds.client import Client
url = 'http://someURL.asmx?WSDL'
client = Client(url)
result = client.service.GetPackageDetails("MyPackage" )
print result
當我運行這個測試腳本,我收到以下錯誤(使用代碼標籤,因爲它不換行):
No handlers could be found for logger "suds.bindings.unmarshaller"
Traceback (most recent call last):
File "sudsTest.py", line 9, in <module>
result = client.service.GetPackageDetails("t3db" )
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 379, in call
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 422, in call
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 480, in invoke
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 505, in send
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 537, in succeeded
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/binding.py", line 149, in get_reply
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 303, in process
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 88, in process
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 102, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 324, in start
suds.TypeNotFound: Type not found: 'xs:complexType'
在源WSDL文件的頭展望(重新格式化,以適合):
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://http://someInternalURL/webservices.asmx"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://someURL.asmx"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
我根據輸出的最後一行猜測:
suds.TypeNotFound: Type not found: 'xs:complexType'
,我需要用Sud酒店的doctor class固定的模式,但作爲一個SOAP新手,我不知道需要什麼固定在我的情況。有沒有人有任何使用Suds修復/更正架構的經驗?
我只是嘗試了一個簡單的C#測試應用程序,它可以連接到這個服務很好(但後來服務是基於ASP.net)。它可能是微軟特定的默認不支持Suds? – Danielb 2009-08-25 22:06:08
它看起來像服務試圖返回一個DataSet。我在記錄器中看到以下內容: 警告:suds.bindings.unmarshaller:屬性(IsDataSet)類型,未找到 警告:suds.bindings.unmarshaller:屬性(名稱)類型,未找到 錯誤:泡沫.bindings.unmarshaller:架構:0x7fce048c – Danielb 2009-08-27 22:57:21
對我來說聽起來像SUDS不是從指定數據集結構的標記導入的。你是否搜索過你的WSDL進口產品? 如果這是答案,那麼SUDS的ImportDoctor應該能夠提供幫助。示例在https://fedorahosted.org/suds/wiki/Documentation#FIXINGBROKENSCHEMAs –
ewall
2009-08-31 17:42:39