This post is not part of my Biblefeed series of posts, but it is very much related. For the Biblefeed project, I was hoping to consume this web service in order to get the data I need to make the project work. The web service appears to be a SOAP web service written in .Net.
In my day job, I develop using C# and VB.Net and use .Net web services all the time. Of course, consuming a .Net web service with a .Net client is very easy. I had hoped that with the relative popularity of the .Net programming languages that python would have a good SOAP library that could make the task easier.
Based I what I’ve been able to discover so far, I can only state that python does indeed have libraries for dealing with SOAP. I have not been able to make any of them work with the web service mentioned above though.
When googling, the first thing I found was SOAPpy and ZSI. I was a bit alarmed that the last release date for these was in 2001. I tried to install SOAPpy, which seemed to install ok, but apparently had a dependency on PyXML, which is no longer maintained. I abandoned trying to use the libraries at this point.
After some digging, I discovered there are two more modern libraries, soaplib and suds. Both of these seemed to be capable libraries. Soaplib seems like it’s a little stronger on the server side and suds looks to be easier to use on the client side.
To use soaplib as client like I want to do here, I need to create stub classes which resemble the structures used by the web service. I played with this for a little while, but gave up on it because I realized that the web service uses Dataset objects, which I couldn’t figure out how to represent in a python stub class.
Suds is a little nicer because it reads the WSDL for the web service to keep from requiring you to build stub classes, however it does not like Dataset’s either. I was running into the issue described here. As of this writing that issue is still open. One of the comments on that issue suggested removing the <s:element ref=“s:schema”/> tags from the WSDL, so I saved the WSDL file locally and tried it. I was able to progress with suds a little further because of that, but when I actually tried to call the webservice it errored out.
So I guess no luck today for me with any SOAP libraries. The examples out there seem to show that consuming web services created in Java or Python works just fine, and even .Net web services can work when they use simple types. Unfortunately I have no control of the service that I want to consume and so I must try something else.
Possible solutions? While I’m sure I could use mono to access the web service and have it return something I can use in python, I don’t want to make my solution too complex. I have an idea that I’m going to try next that will involve Django’s template system. If it works, it will be in the next post concerning the Biblefeed project.