使用SUDS和python打印客户端时的空服务列表

问题描述:

当我使用SUDS进行打印时,我没有收到任何有关我的SOAP客户端的信息。使用SUDS和python打印客户端时的空服务列表

代码:

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 

好像Web服务不能用肥皂水,所以我发现它与XML请求工作。在这里找到正确答案:Python: Making a request with suds