Python suds创建obj时出错

2024-05-18 18:57:25 发布

您现在位置:Python中文网/ 问答频道 /正文

正在尝试使用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

为了简洁起见进行了裁剪,但是显示了名称空间和我现在关心的两种类型。在

尝试运行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?在


Tags: httpscomclientapihttp类型createservice
2条回答

看看WSDL,http://*中似乎有很多定义。api.echosign公司肥皂水吸不到。在

或者更新您的/etc/hosts以使这些格式不正确的域可以访问,或者在本地保存wsdl,修改它,然后使用Client('文件://。。。',…)来创建你的suds客户端。在

又一次,我在这里贴了15分钟就搞定了。在

suds可以选择交叉授粉所有名称空间,这样它们就可以互相导入模式。autoblend可以在构造函数中设置,也可以使用set_options方法进行设置。在

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

相关问题 更多 >

    热门问题