webservices

Christopher Blunck blunck at gst.com
Fri May 16 00:11:07 EDT 2003


Randall Smith <randall at tnr.cc> wrote in message news:<1Xbva.63306$8e7.2938325 at twister.austin.rr.com>...
> I'm interested in learning how to implement and consume web services 
> using Python.  I downloads ZSI and SOAPpy from the pywebsvs project and 
> played with them, but can't do much now.  I'm looking for some 
> direction.  What fundamentals should I know and where are good resources 
> for learning about webservices with Python?

ZSI and SOAPpy are really great projects that cover most (all?) of the
web service constructs you'll need.  ZSI allows you to expose the
functions in a python module as a web service.  For example, let's say
you have the following functions:

def sum(num1, num2):
  return num1 + num2

def multiply(num1, num2):
  return num1 * num2


If you wanted to expose these as a web service, all you'd have to do
is add one
line:

dispatch.AsServer(port=8000)



ZSI also contains powerful client side binding utilities.  To invoke
these services, all you'd have to do is:

from ZSI import ServiceProxy
service = ServiceProxy('http://foo.com/path/to/module.wsdl')
sum = service.sum(1, 5)


If you are interested in learning about the web service architecture,
create a simple module like the one above and start fiddling around
with stuff.  You'll quickly find that there is a huge domain of
interesting (and challenging problems) to solve once you scratch the
surface.

Best of luck,
-c




More information about the Python-list mailing list