#205 patch for wsdl2dispatch to work with mod_python

v2.0
open
nobody
zsi (169)
5
2007-05-23
2007-05-23
dkindred
No

Attached is a patch to allow the code generated by wsdl2dispatch to work with mod_python. Patch is against ZSI v2.0, tested with python 2.5, mod_python 3.3.1 and Apache 2.2.4.

Here's an example of how to use AsMPHandler():

from mod_python import apache
from ZSI.ServiceContainer import AsMPHandler
import MySOAPServer

mod = __import__('encodings.utf_8', globals(), locals(), '*')
mod = __import__('encodings.utf_16_be', globals(), locals(), '*')

serviceImpl = MySOAPServer.MyService()

def handler(req):
if req.method == 'GET':
# if GET method was called with 'MySearch?wsdl' at the end,
# then return the wsdl
if req.args == 'wsdl' and \ req.filename == req.document_root() + serviceImpl.post:
req.content_type = "text/xml"
req.write(serviceImpl._wsdl)
else:
# otherwise, return a blank page
req.content_type = "text/html"
req.send_http_header()
req.write("<html><head><title>My Search Service</title></head><body>")
# we could stick a message here if we wanted to.
req.write("</body></html>")
return apache.OK
elif req.method == 'POST':
# services are handled through the POST method
AsMPHandler(request=req, services=(serviceImpl,))
return apache.OK
else:
return apache.DECLINED

Discussion

  • dkindred
    dkindred
    2007-05-23

    patch for wsdl2dispatch to work with mod_python

     
    Attachments