gpt4 book ai didi

Python suds 错误创建对象

转载 作者:太空宇宙 更新时间:2023-11-04 09:14:04 26 4
gpt4 key购买 nike

尝试使用 echosign SOAP API。

wsdl 在这里:https://secure.echosign.com/services/EchoSignDocumentService14?wsdl

当我尝试创建某些对象时,它似乎无法找到类型,即使在 print client 中列出它也是如此

import suds

url = "https://secure.echosign.com/services/EchoSignDocumentService14?wsdl"

client = suds.client.Client(url)
print client


Service ( EchoSignDocumentService14 ) tns="http://api.echosign"
Prefixes (10)
ns0 = "http://api.echosign"
ns1 = "http://dto.api.echosign"
ns2 = "http://dto10.api.echosign"
ns3 = "http://dto11.api.echosign"
ns4 = "http://dto12.api.echosign"
ns5 = "http://dto13.api.echosign"
ns15 = "http://dto14.api.echosign"
ns16 = "http://dto7.api.echosign"
ns17 = "http://dto8.api.echosign"
ns18 = "http://dto9.api.echosign"
Ports (1):
(EchoSignDocumentService14HttpPort)
Methods (45):
...
Types (146):
ns1:CallbackInfo
ns17:WidgetCreationInfo

为简洁起见进行了删减,但显示了命名空间和我现在关心的 2 种类型。

尝试运行 WCI = client.factory.create("ns17:WidgetCreationInfo") 生成此错误:

client.factory.create("ns17:WidgetCreationInfo") Traceback (most recent call last): File "", line 1, in File "build/bdist.macosx-10.7-intel/egg/suds/client.py", line 244, in create suds.BuildError: An error occured while building a instance of (ns17:WidgetCreationInfo). As a result the object you requested could not be constructed. It is recommended that you construct the type manually using a Suds object. Please open a ticket with a description of this error. Reason: Type not found: '(CallbackInfo, http://dto.api.echosign, )'

因此它似乎无法找到 CallbackInfo 类型。也许是因为那里缺少 ns?

最佳答案

同样,在此处发帖 15 分钟后想通了。

suds 有一个选项可以交叉授粉所有命名空间,因此它们都可以导入彼此的模式。 autoblend 可以在构造函数中设置,也可以使用 set_options 方法设置。

suds.client.Client(url, autoblend=True)

关于Python suds 错误创建对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11532756/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com