Send POST Request To Web Services In Python
I need to consume a several's SOAP web services, if I send a xml file as request I get the response without issues. But I want to send only some arguments and not all the xml file
Solution 1:
Time has passed, but maybe someone finds it useful:
This is snippet from my project. You can add parameters directly to method.
SUDS is very powerful in that way, and of course check out docs.
from Tkinter import *
from suds.client import *
class SoapClass:
def __init__(self, master):
self.client = Client('http://www.webservicex.net/ConvertWeight.asmx?WSDL', username='', password='', faults=False)
Button(master, text='Call', command=self.request).pack()
def request(self):
methodName = 'ConvertWeight'
params = [80, 'Kilograms', 'Grams']
MethodToExecute = getattr(self.client.service, methodName)
try:
response = MethodToExecute(*params)
except WebFault as e:
response = e
print(response)
root = Tk()
app = SoapClass(root)
root.mainloop()
Post a Comment for "Send POST Request To Web Services In Python"