我正在尝试为 Textbroker API 创建 Python 客户端,但在访问其 SOAP 接口(interface)时遇到问题。我可以正常访问登录服务 ( https://api.textbroker.com/Budget/loginService.php?wsdl ),但是当我尝试访问预算检查服务 ( https://api.textbroker.com/Budget/budgetCheckService.php?wsdl ) 时,我收到以下错误消息:
suds.TypeNotFound: Type not found: '(Struct, http://www.w3.org/2001/XMLSchema, )'
据我了解阅读其他类似问题,我需要使用 ImportDoctor 来解决此问题。我尝试了以下方法:
class BaseService:
password = None
wsdl = None
client = None
def __init__(self):
imp = Import('http://www.w3.org/2001/XMLSchema')
imp.filter.add("urn:loginService")
self.client = Client(self.wsdl, doctor=ImportDoctor(imp), cache=None)
但不幸的是我仍然收到相同的错误消息。我几乎确定我需要使用 ImportDoctor 来解决这个问题,我只是做错了。
最佳答案
根据这个答案:SOAP suds and the dreaded schema Type Not Found error您可能需要向 Import() 添加特定位置
imp = Import('http://www.w3.org/2001/XMLSchema',
location='http://www.w3.org/2001/XMLSchema.xsd')
关于python - SOAP suds 库类型未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38528653/