Using SUDS to test WSDL

chrisg picture chrisg · Jan 14, 2010 · Viewed 24.1k times · Source

Does anyone know about a good SUDS tutorial. I am trying to run tests on WSDL files and I am having trouble finding any imformation on how to do this. Is SUDS much different to SOAPy and would anyone recommend it to run smoke tests on functions stored in WSDL files.

I have read that SOAPAy is no longer supported in Python 2.6+. Is this true?

I have a WSDL file I have entered:

from suds.client import Client

client = Client('http://10.51.54.50/ptz.wsdl')

client.service.GetNode()

I got this error:

    in open
    response = self._open(req, data)
  File "/home/build/workspace/downloads/Python-2.6.4/Lib/urllib2.py", line 407, in _open
    '_open', req)
  File "/home/build/workspace/downloads/Python-2.6.4/Lib/urllib2.py", line 367, in  _call_chain
    result = func(*args)
  File "/home/build/workspace/downloads/Python-2.6.4/Lib/urllib2.py", line 1146, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/home/build/workspace/downloads/Python-2.6.4/Lib/urllib2.py", line 1121, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>

Does anyone know why this is happening?

I can connect to this file through my browser. I have installed all the suds packages. Is there any other setup required?

Answer

lutz picture lutz · Jan 14, 2010

Suds is very simple to use.

from suds.client import Client

client = Client("http://example.com/foo.wsdl")
client.service.someMethod(someParameter)

someMethod is the name of a method as described in the WSDL.