问题描述
我使用的是最新版本的 suds (https://fedorahosted.org/suds/) 第一次,我在第一步停滞不前.
I'm using the latest version of suds (https://fedorahosted.org/suds/) for the first time and I'm getting stalled at step one.
suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'
现在,我知道这在 suds 世界中已经有了很好的覆盖面 (https://fedorahosted.org/suds/wiki/TipsAndTricks#Schema-TypeNotFound" rel="nofollow noreferrer">https://fedorahosted.org/suds/wiki/TipsAndTricks#Schema-TypeNotFound 和 Python/Suds: Type not found: 'xs:complexType') 但这似乎略有不同,因为 (a) 模式应该在 0.3.4 版本之后自动绑定,并且 (b) 甚至明确使用解决方法,它还是不行.
Now, I know this is well covered ground in the suds world (https://fedorahosted.org/suds/wiki/TipsAndTricks#Schema-TypeNotFound and Python/Suds: Type not found: 'xs:complexType') but this appears to slightly different because (a) schema is supposed to be automatically bound after version 0.3.4 and (b) even explicitly using the workaround, it still doesn't work.
from suds.client import Client
from suds.xsd.sxbasic import Import
url = 'file:wsdl.wsdl'
Import.bind('http://schemas.xmlsoap.org/soap/encoding/')
client = Client(url, cache = None)
使用 wsdl:
<?xml version="1.0" encoding="utf-8"?>
<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="http://ws.client.com/Members.asmx"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://ws.client.com/Members.asmx"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://ws.client.com/Members.asmx">
<s:element name="GetCategoriesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCategoriesResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
</wsdl:definitions>
产生上述异常.
推荐答案
我们让它工作了,我希望你也这样做,尽管它有点古怪.也许明确的位置或过滤器会有所帮助.例如:
We got it working and I hope you did as well, even though it is a bit quirky. Perhaps an explicit location or filter will help. 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)])
这篇关于SOAP 泡沫和可怕的架构类型未找到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!