尝试加载WSDL时出现suds错误

时间:2015-01-30 15:25:32

标签: python soap suds

我正在尝试使用最新版本的suds加载WSDL但是收到下一个错误:

from suds.client import Client

//....
client = Client(url)

Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

我尝试过使用Import和ImportDoctor函数,就像其他线程所说的那样,但我得到了完全相同的结果。

from suds.xsd.doctor import ImportDoctor, Import
imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add('https://www.soapservice.co.uk/test_ws')
doctor = ImportDoctor(imp)
client = Client(url, doctor=doctor)

Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

这些是WSDL定义

<wsdl:definitions 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:tns="https://www.soapservice.co.uk/test_ws" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
targetNamespace="https://www.soapservice.co.uk/test_ws">
..............
..............
<wsdl:binding name="WebSoap" type="tns:WebSoap">
.............
</wsdl:binding>
<wsdl:binding name="WebSoap12" type="tns:WebSoap12">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>

1 个答案:

答案 0 :(得分:0)

我猜显式位置或过滤器会有所帮助。 E.g:

imp = Import('http://schemas.xmlsoap.org/soap/encoding/', location='http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add('http://ws.client.com/Members.asmx')
client = Client(url,plugins=[ImportDoctor(imp)]
相关问题