尝试加载 WSDL 时出现 UDS 错误



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

from suds.client import Client
//....
client = Client(url)
Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

我尝试使用导入和导入医生功能,正如其他线程所说,但我得到了完全相同的结果。

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>

我想明确的位置或过滤器会有所帮助。 例如:

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)]

最新更新