dews is a Python module that offers dead-simple Web Services for Python.
Although exposing a Web Service is getting pretty simple these days, when you're using the proper IDE and following the recipes, getting to known the inner details of a SOAP stack can be a daunting task. For instance, if you are experimenting with extensions or simply want to learn how it works.
Inspired by Ryan Kelly's dexml, the dead simple Object-XML mapper, and by K. Jacobson's simple Python Web Service framework blog entry, dews is small and simple. In fact, there is a long way to go to comply with the Web Services standards.
Exporting a Web Service is as easy as defining request and response classes in Python using dexml with corresponding handler functions:
>>> from dexml import Model, fields
>>> class HelloNS(Model):
... class meta:
... namespace = "http://localhost/hello"
... namespece_prefix = "h"
...
>>> class Hello(HelloNS):
... name = fields.String()
...
>>> class HelloResponse(HelloNS):
... greeting = fields.String()
...
>>> def hello(r):
... return HelloResponse(greeting='Hello '+r.name)
And then creating the HTTP server:
>>> from BaseHTTPServer import HTTPServer
>>> from dews import http
>>> HTTPServer(('localhost',8080),
... http.handler('Hello', (Hello,HelloResponse,hello),)
... ).serve_forever()
This will serve the WSDL on http://localhost:8080. No client is provided by dews but I recommend Suds (https://fedorahosted.org/suds/).
Product's homepage
Requirements:
· Python