【发布时间】:2021-07-29 13:02:51
【问题描述】:
我正在尝试用 SUDS、Python 创建一个 SOAP 客户端,但没有成功。
WSDL 在这里:https://login.keyinvoice.com/API3_ws.php?wsdl
代码:
from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor
imp = Import("http://schemas.xmlsoap.org/soap/encoding/", location="http://schemas.xmlsoap.org/soap/encoding/")
imp.filter.add("http://login.keyinvoice.com/soap/KI_API3")
client = Client("https://login.keyinvoice.com/API3_ws.php?wsdl", doctor=ImportDoctor(imp))
错误:
suds.TypeNotFound: Type not found: '(Array, http://www.w3.org/2001/XMLSchema, )'
我试过了,没有成功:
- “http://www.w3.org/2001/XMLSchema”作为导入类中的参数
- Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )
- https://github.com/unomena/suds/issues/2
- Zeep 女巫也不能完全正常工作(它没有构建“身份验证”方法)。
然后我尝试了一个Node lib,它可以正常工作,但我不能使用它。
是 WSDL 损坏了吗? ImportDoctor 的参数是否错误? SUDS 错误?
(Python 3.8.2,suds-community==0.8.5)
谢谢!
【问题讨论】:
-
似乎 WSDL 有 2 种不同的引用数组的方式。一个是 xsd:array,另一个是 SOAP-ENC:Array。 xsd 定义为 xmlns:xsd="w3.org/2001/XMLSchema,SOAP-ENC 定义为 xmlns:SOAP-ENC="schemas.xmlsoap.org/soap/encoding"。