I used to use something like SoapUI for casual calling of webservices. But most of the time a GUI feels like overkill for just calling one webservice function.
Recently I found the python SUDS library . It is so simple that I now just launch my all webservice calls from the command line.
from suds import WebFault
from suds.client import Client
client = Client('http://localhost:8080/myapp/mywebservice?wsdl')
print client
print client.service.MyFunction('Hello')
The “print client” in the middle prints an overview of the functions defined in the wsdl (nice to have). It is really easy. The only problem is that SUDS is not packaged in Debian/Ubuntu yet, so it is a little more trouble to install than just “apt-get install ….”. Maybe I should try to do something about that.










Hi,
I tried using suds the way its mentioned in the docs and above example. But python is unable to receive response
It gives me the following error
=====================================================
Suds ( https://fedorahosted.org/suds/ ) version: 0.3.5 (GA) build: R494-20090403
Service ( Hello ) tns=”http://www.example.org/Hello/”
Prefixes (0)
Ports (1):
(HelloSOAP)
Methods (1):
HelloWorld(xs:string HelloWorldRequest, )
Types (0):
Traceback (most recent call last):
File “C:/PythonEx/sudex.py”, line 11, in
resp.set_element_HelloWorldResponse = client.service.HelloWorld(‘IssacRenuka’)
File “build\bdist.win32\egg\suds\client.py”, line 240, in __call__
return target.call(*args, **kwargs)
File “build\bdist.win32\egg\suds\client.py”, line 379, in call
return method(*args, **kwargs)
File “build\bdist.win32\egg\suds\client.py”, line 240, in __call__
return target.call(*args, **kwargs)
File “build\bdist.win32\egg\suds\client.py”, line 422, in call
return client.invoke(args, kwargs)
File “build\bdist.win32\egg\suds\client.py”, line 480, in invoke
result = self.send(msg)
File “build\bdist.win32\egg\suds\client.py”, line 505, in send
result = self.succeeded(binding, reply.message)
File “build\bdist.win32\egg\suds\client.py”, line 537, in succeeded
r, p = binding.get_reply(self.method, reply)
File “build\bdist.win32\egg\suds\bindings\binding.py”, line 132, in get_reply
replyroot = self.parser.parse(string=reply)
File “build\bdist.win32\egg\suds\sax\parser.py”, line 128, in parse
parseString(string, handler)
File “C:\Python26\lib\xml\sax\__init__.py”, line 49, in parseString
parser.parse(inpsrc)
File “C:\Python26\lib\xml\sax\expatreader.py”, line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File “C:\Python26\lib\xml\sax\xmlreader.py”, line 123, in parse
self.feed(buffer)
File “C:\Python26\lib\xml\sax\expatreader.py”, line 211, in feed
self._err_handler.fatalError(exc)
File “C:\Python26\lib\xml\sax\handler.py”, line 38, in fatalError
raise exception
SAXParseException: :1:0: syntax error
=====================================================
Code is as follows
============================
from suds import WebFault
from suds.client import Client
client = Client(‘http://localhost:8080/axis2/services/Hello?wsdl’)
print client
client.service.HelloWorld(‘ABC’)
Hi Renuka,
It seems you get a parse error – so maybe your axis server does not return what you expect.
To test just the suds code you can try to connect to a service on the internet. Eg.
==============
from suds import WebFault
from suds.client import Client
client = Client(‘http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl’)
print client
print client.service.LatLonListZipCode(‘90210′)
===============
Good luck.
Anders