Error in python webservice client using suds

谁说胖子不能爱 提交于 2020-01-06 13:11:11

问题


Im using python 2.7 and suds 0.4 in windows and linux and in both cases I get the same error when calling a method of a web service:

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'

My code is really simple:

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()

As you can see I already did what the author of suds suggest here and also did the logging in here. But the result is the same.

Any ideas will be appreciated.

Regards.


回答1:


My understanding about web services was not good enough and the service implementation is using http for exposing the wsdl AND https for the service endpoint.

So after a helpful hint of the service author I declared the client as:

client = Client('http://someUrl?wsdl', 
                location='https://someUrl/Service.svc')

And that solved the problem. There was nothing bad with suds.



来源:https://stackoverflow.com/questions/30111292/error-in-python-webservice-client-using-suds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!