SOAP.py and ZSI can swap roles
In this installment of The Python Web services developer, Mike Olson gets back to writing some Python code. This column will revisit the example code from the fifth and sixth columns in this series, in which Mike and Uche Ogbuji talked about SOAP.py and ZSI, two available SOAP implementations in Python. Mike will continue the examination of these libraries and see how they interact with each other.
One of the promises of Web services is interoperability. As we explained in previous columns, Web services built with different programming languages and on different platforms should work together just as well as services provided by the same programming language. In this installment of The Python Web services developer, I will take the client and server for the calendar Web service that we implemented in previous articles in this column and see how they interoperate with each other.
To use the samples within this
article, follow the installation steps for SOAP.py in the fifth
installment in this series and for ZSI in the sixth. (You should review
both those articles for background on SOAP.py and ZSI; you can find
links to them in the Resources
section.) As a side note, a newer version of ZSI has recently become
available: version 1.2 was released in March of this year. The samples
presented in this column do work with both ZSI 1.1 and 1.2. For those
interested in upgrading, see the Resources section below for a URL where you can download the latest version. Installation uses standard distutils
commands. If you have a previous version of ZSI installed, you should
remove it first to avoid conflicts. To install the new version, untar
the distribution and change into the ZSI-1.2
directory. Execute the install command as follows:
|
Flipping it around: ZSI server, SOAP.py client
The first thing you need to do to in order to test a SOAP.py client
with the ZSI server is to write the SOAP.py client. If you remember, we
wrote a very low-level client to test the SOAP.py server using httplib
(see the Resources
for the sixth column on ZSI). Since you want to see how SOAP.py
interacts with ZSI, this will not do. A quick client can be written to
use your calendar Web service, as shown in Listing 2.
|
This client is implemented similarly to the curses
client from the fifth column. One thing to note is that the namespace argument to the SOAPProxy
is commented out. Just as the default implementation of the ZSI client was not namespace aware, the server is not either.
Again, to run the sample scripts, start the SOAP.py server in one window:
|
And the ZSI client in a second window:
|
As expected (since this client was written specifically to communicate with the SOAP.py server) you get back a calendar for February 2002.
View Python SOAP libraries, Part 3 Discussion
Page: 1 2 3 Next Page: ZSI and namespaces