【问题标题】:How to create complex arguments with Zeep (SOAP client for Python) and nest data?如何使用 Zeep(Python 的 SOAP 客户端)创建复杂的参数并嵌套数据?
【发布时间】:2016-07-13 21:40:09
【问题描述】:

我需要将一些嵌套数据传递给我的 SOAP 客户端,我想我知道如何创建复杂的参数...

id = ucmdb.get_type('ns17:ID')

现在我想给这个'ci'一些“论据”,我该怎么做? 我将通过一个使用我知道如何使用的旧 Suds 的示例来说明我的意思:

id = ucmdb.factory.create('ns17:ID') #complex
id._temp = "true" #first "argument"
id.value = dict['logical_name'] #second "argument"

我怎样才能用 Zeep 做到这一点?

【问题讨论】:

    标签: python soap soap-client python-3.5


    【解决方案1】:

    查看http://docs.python-zeep.org/en/latest/in-depth.html 中的“使用 SOAP 标头”部分。

    我能够使用该信息编写与 Zuora 集成的脚本,并且需要在 Soap Header 中使用复杂类型。见http://community.zuora.com/t5/API/Python-quickstart/m-p/10779/highlight/true#M403

    【讨论】:

    • 它说“SOAP 标头通常用于身份验证之类的事情”,所以它用于此目的,我对 Web 服务了解不多,因此可以提供一些帮助或解释需要请。谢谢!
    • 尝试了你所做的:intProp_type = client.get_type('ns17:IntProp') intProp = intProp_type(name = "slots", value = 56) 但它不起作用,出现错误:KeyError: "No type 'IntProp' in namespace schemas.hp.com/ucmdb/ui/1/types。可用类型是:{schemas.hp.com/ucmdb/ui/1/types} ClassNameAndIcons,{schemas.hp.com/ucmdb/ui/1/types}ClassNameAndIcon"
    • 你能解释一下“client.service.create”的方法是什么吗?
    • "client.service.create" 调用 create 方法(由 wsdl 定义)。您的 wsdl 中可能有也可能没有这样的方法。看起来您的 wsdl 确实 not 包含类型“ns17:IntProp”。您可以按如下方式检查 wsdl 中的内容:python -mzeep
    猜你喜欢
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多