Good to hear from you!
Suds looks like a good start. It's a nice looking code base. So it's too bad I couldn't get any of the unit tests to pass on Jython 2.5 trunk. There might be something simple blocking this however...
I looked into ZSI a bit more. The trunk version no longer uses PyXML, so that is quite important for both CPython and Jython, given that PyXML is no longer supported. It relies on xml.dom.expatbuilder. In Jython 2.5 trunk, this is currently not part of the build, since until recently we had no expat. But the general trick in Jython, is copy the code, it might work. And with that, over half the unit tests for ZSI passed. That's quite an encouraging number at a first go.
Looking at where they fail, this is due to the current expat emulation not supporting ordered_attributes and the undocumented parser attribute, intern. There may of course be more.
Echoing another responder, you might give a look at suds. Although, there is no hope of using suds with Jython 2.2, you'd have to be going the Jython 2.5 route. A favorable aspect of suds is that the author includes almost a dozen test cases against publicly available Web Services endpoints. Beware running all of them at the same time, the output is voluminous unless you adjust the logging level. As an example, the first example basically echoes a a string back, an integer back and then a floating point number back. The SOAP message itself is less than 50 lines (approx). The output you see will exceed 20K lines!
You can also Google for WS02 and Jython. You'll find an open source package that requires the Apache Axis2 jar(s) and the service jar. (That was a dealbreaker for me in the environment I had to deploy into). I have no idea how complete/good/usable that package is.
Ultimately, I went the route of using SOAPUI (Windows app) that leverages Apache Axis 1.4 to generate the XML for the SOAP requests and then used those as templates that I filled with actual data at run time, then threw the SOAP at the endpoint using urllib2. As the requests were limited in number (half a dozen) and fairly simple, this approach worked out rather well. Parsing the response was pretty straightforward as well as there were only a limited number of elements that I was interested in.
If you are only just entering the world of web services, here's a couple of links that you may find enlightening (and at the same time depressing):
> Date: Sun, 21 Dec 2008 17:54:28 -0500
> From: Michael Chisholm <email@example.com>
> Subject: [Jython-users] SOAP web services and Jython
> I've been trying to find a way to use SOAP web services from Jython.
> The main Python library seems to be ZSI, which depends on PyXML, which
> depends on expat, which is not Java, so it isn't usable from Jython.
> SOAPpy has the same problem (PyXML dependence). PyXML itself doesn't
> even seem to be maintained anymore (see
> http://sourceforge.net/projects/pyxml/). Anyway, the latest update from
> ZSI seems to be from almost 2 years ago, so it isn't looking too active
> Alternatively, of course, I could just use a Java API like Axis or
> JAX-WS from Jython. But Java isn't as dynamic a language as Python, and
> I don't want to have to generate Java stubs. The goal is to be able to
> access web services from a Python environment, without having to know
> Java or need to modify the execution environment (so no java
> compilation, classpath modification, etc). You should be able to just
> import some packages and write some python code, and thats it.
> The state of affairs w.r.t. Python and SOAP web services seems rather
> depressing--only one game in town, which isn't very active, isn't
> pure-Python, relies on unmaintained packages, and has no easy way of
> building on Windows anyway (see
> ; someone else had to figure out a way and make it available, and thats
> only for Python 2.5).
> Are any of you accessing SOAP web services from Jython? How did you do it?> Andy
Jython-users mailing list