【问题标题】:How do I create a non-standard type with SOAPpy?如何使用 SOAPpy 创建非标准类型?
【发布时间】:2008-09-23 00:46:14
【问题描述】:

我正在使用 SOAPpy 从 Python 调用 a WSDL web service。我需要调用方法Auth_login。这有 2 个参数 - 第一个,一个字符串是 API 密钥;第二个,custom type containing username and password。自定义类型称为 Auth_credentialsData,其中包含 2 个值作为字符串 - 一个用于用户名,一个用于密码。如何使用 SOAPpy 创建此自定义类型?我尝试传递一个列表和一个字典,但都不起作用。

到目前为止的代码:

from SOAPpy import WSDL

wsdlUrl = 'https://ws.pingdom.com/soap/PingdomAPI.wsdl'
client = WSDL.Proxy(wsdlUrl)

都试过了:

credentials = ['email@example.com', 'password']
client.Auth_login('key', credentials)

credentials = {'username': 'email@example.com', 'password': 'passsword'}
client.Auth_login('key', credentials)

两者都给出身份验证失败错误。

【问题讨论】:

    标签: python web-services soap


    【解决方案1】:

    更好的方法是使用 ZSI soap 模块,它允许您获取 WDSL 文件并将其转换为您可以用来调用它的类和方法。在线文档是 on their website,但在源代码包中更容易找到最新的文档。如果您在 Debian/Ubuntu(软件包名称 python-zsi)中安装,文档位于 /usr/share/doc/python-zsi 的一对 PDF 中,您可以在其中找到。

    【讨论】:

      猜你喜欢
      • 2021-04-10
      • 1970-01-01
      • 1970-01-01
      • 2021-08-20
      • 2023-03-13
      • 1970-01-01
      • 2011-07-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多