Python/SOAP: second encounter
Python, Web January 15th, 2008
It looks like my experience in Python/SOAP programming no better than the first encounter. Here is the full story:
I am working on a client application to consume Microsoft SharePoint server web service recently. Since the client does not support scripting, I decided to develop a Python console application to ease my routine job.
The first two candidate are SOAPpy and ZSI. SOAPpy is the official library used in the DiveIntoPython, and ZSI is the succeeder of SOAPpy.
The first problem I have met in Python 2.5 environment is ZSI-2.0 depends on PyXML, which is not compatible to Python 2.5 though, so I migrated to ZSI-2.1_a1, and eventually get ZSI successfully imported. ZSI supports two approaches to use WSDL, I must admit I won’t consider any web service without WSDL.
- ServiceProxy: dynamically build the method proxy in the run time
- wsdl2py: generate the python code in compile time for later use
Neither of them works even for a simple web service from xmethods.com. Some type error or attribute exception is thrown when calling service method.
So I went back to the traditional SOAPpy. Though it is a little annoying to build fpconst, (thanks to easy_install to make it less painful), I really love the SOAPpy’s API, simple and stupid:
wsdlFile = ‘http://www.xmethods.net/sd/2001/TemperatureService.wsdl’)
server = WSDL.Proxy(wsdlFile)
server.foo(‘bar’)
However, the SOAPpy generate wrong SOAP message. Once the type is declared as sequence, the SOAPpy would insert
Don’t forget we have not touched the authentication, NTLM, the default certification policy used in most of the SharePoint server in the Intranet. This is really a long way to go.
UPDATE: Moved to Web category, so it won’t pollute the Gentoo Planet.
UPDATE: Thanks to Lawrence’s advice, I did try soaplib tonight last night. It is really a promising library for SOAP, the parser is based upon cElementTree, so it is supposed fast and memory-friendly. Once you build the service provider, Bang, you already get the consumer application. The only problem is there is no official support for WSDL. wsdl2py in ext package seems promising, it is under active development and should not be used in a production scenario, and checked-in 1 year ago. No wonder there are tons of errors in WSDL parsing. I just wonder optio developers may have a private code repository for daily check-in, and they may sync their work to the public from time to time.
Once I finish WSDL specification, I may refactor the wsdl2py module.







This is really disheartening.
Did you try soaplib?
http://trac.optio.webfactional.com/
To DeanG:
My fault, I should not post it in Gentoo category. Fixed already.
BTW, I am just Tell the Truth, the Whole Truth, and Nothing but the Truth.
The example can’t work since http://www.xmethods.net/sd/2001/TemperatureService.wsdl
throws a 404 not found.
Seems like all the xmethods demo service are out of commission.
Are you saying that Python cannot be used to access SharePoint services? This is sad.
I was begining to be despair like you when I found this lib : https://fedorahosted.org/suds. I have not tested it extensively but it looks very promising.
[...] the last post, I was whining about the bumps in the road when trying to consume a SOAP web service using python. [...]
Suds looks from my initial glance to be the most Pythonic way of dealing with SOAP Web Services as a client.
Unfortunately, I can not yet get it to work with a .NET (asmx extension) web service.
I have not tried the sharepoint communication with our servers at work yet. That is next.
I have high hopes for Suds.
I tried suds and it’s the first SOAP lib I’ve seen just working. Didn’t have any luck with SOAPPy and ZSI.
Good thread.
Anyone to speak for a good library for implementing SOAP server in python?
M
Great thread – I am still trying to come to terms with the fact that there is so little decent support for web services in Python….I looked to Django/Python as an alternative to .Net and had high hopes…hopefully suds does the trick as soappy failed dismally when trying to call .net generated web services
can you tell me , which one is better to use(SOAPpy or ZSI)?? and which one is faster?