首页 文章

Python suds创建对象的错误

提问于
浏览
1

尝试使用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(最近一次调用最后一次):文件“”,第1行,在文件“build / bdist.macosx-10.7-intel / egg / suds / client.py”中,第244行,在create suds.BuildError:构建(ns17:WidgetCreationInfo)实例时发生错误 . 因此,无法构造您请求的对象 . 建议您使用Suds对象手动构造类型 . 请打开一张带有此错误描述的票证 . 原因:未找到类型:'(CallbackInfo,http://dto.api.echosign,)'

因此它似乎无法找到CallbackInfo类型 . 也许是因为它错过了那里的ns?

2 回答

  • 0

    再次,在这里发布后15分钟计算出来 .

    suds可以选择对所有命名空间进行交叉授权,以便它们都可以导入彼此的模式 . autoblend 可以在构造函数中设置或使用 set_options 方法 .

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

    看一下WSDL,http://*.api.echosign中似乎有很多定义,suds无法获取 .

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

相关问题