我在Windows和Linux中使用python 2.7和suds 0.4,在这两种情况下,我在调用Web服务的方法时都会遇到同样的错误:
Traceback (most recent call last):
File "wsclient.py", line 23, in <module>
client.service.Echo()
File "build\bdist.win32\egg\suds\client.py", line 542, in __call__
File "build\bdist.win32\egg\suds\client.py", line 602, in invoke
File "build\bdist.win32\egg\suds\client.py", line 643, in send
File "build\bdist.win32\egg\suds\client.py", line 678, in succeeded
File "build\bdist.win32\egg\suds\bindings\binding.py", line 149, in get_reply
AttributeError: 'NoneType' object has no attribute 'promotePrefixes'
我的代码很简单:
import suds.bindings
suds.bindings.binding.envns = ('SOAP-ENV', 'http://www.w3.org/2003/05/soap-envelope')
from suds.client import Client
url = 'http://servicios.publipayments.com/ServicioDW.svc?wsdl'
client = Client(url)
print client
client.service.Echo()
正如您所看到的,我已经做了suds的作者建议here并且还在here中进行了登录。但结果是一样的。
任何想法都将受到赞赏。
问候。
答案 0 :(得分:0)
我对Web服务的理解不够好,服务实现使用http来公开服务端点的wsdl和https。
因此,在对服务作者提示之后,我将客户端声明为:
client = Client('http://someUrl?wsdl',
location='https://someUrl/Service.svc')
这解决了这个问题。肥皂水没什么不好。