【问题标题】:Empty list of services when printing client with SUDS and python使用 SUDS 和 python 打印客户端时的空服务列表
【发布时间】:2016-04-26 07:36:10
【问题描述】:

当我使用 SUDS 打印 SOAP 客户端时,我没有得到任何信息。

代码:

url = 'https://website.com/API/AuthenticationService.asmx'
headers = {'Content-Type': 'text/xml; charset=utf-8'}
client = Client(url, headers = headers)
print client

打印结果:

Suds ( https://fedorahosted.org/suds/ )  version: 0.6

我应该可以使用 XML 传递用户名和密码:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Login xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://Iris.net">
<username>Username</username>
<password>Password</password>
</Login>
</s:Body>
</s:Envelope>

如果我尝试使用任何服务或工厂名称空间,我会收到错误消息。

尝试使用服务:

response = client.service.Login(username)

错误:

Exception: No services defined

还有工厂:

    login = client.factory.create('Login')

错误:

Exception: (Login, None, ), must be qref

【问题讨论】:

    标签: python django soap suds


    【解决方案1】:

    Web 服务似乎无法使用 suds,所以我发现它适用于 xml 请求。在这里找到正确答案:Python: Making a request with suds

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-11
      • 1970-01-01
      相关资源
      最近更新 更多