WebService request with python suds by XML

筅森魡賤 提交于 2019-12-07 20:56:54

问题


i'm trying to comunicate with a webserver with python. I'm using the suds library. Actually i'm pretty new with this. Usually, to comunicate with this WebServer a send a xml message and i get a response. So this is what i would like to do with python.

Here's the code i wrote:

from suds.client import Client

with open("PATH","r") as f:
    file=f.read()

url='URL'
client = Client(url)
httpHeaders = {'Content-Type': 'text/xml', 'SOAPAction': 'ACTION'}
client.set_options(headers=httpHeaders)

Now i don't know how to make the request. I tried this:

print client.service.test(__inject={'msg': file})

But i got the error:

Exception: No services defined

The problem seems clear, but i don't know haw to procede. Any suggestion ?

来源:https://stackoverflow.com/questions/24103950/webservice-request-with-python-suds-by-xml

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