| justind 
    justind at ussonet.net Fri Aug 11 16:45:35 EDT 2006 
 I posted on the ZSI board to, thought I better here just to cover all 
the bases.
Has anyone used ZSI with mod_python? If so, there is an example of how 
to use ZSI with mod_python in ZSI's documentation.
This feels  like a "I'm being stupid and forgetting/overlooking 
something obvious" type of problem.
 From the example below, there is a module called MyHandler that has 3 
functions (hello,echo and average). You expose these functions through 
the dispatch.AsHandler() function in the mod_python code.
Suppose that I only wanted to expose the hello and echo functions, but 
not the average function. I want to keep the average function in the 
module because some other function(s) I will make later will use it.
(Section 2.1.3).
The following is a complete example of a simple handler. The soap 
operations are implemented in the MyHandler module:
def hello():
    return "Hello, world"
def echo(*args):
    return args
def average(*args):
    sum = 0
    for i in args: sum += i
    return sum / len(args)
Dispatching from within mod_python is achieved by passing the 
aforementined MyHandler module to |dispatch.AsHandler()|. The following 
code exposes the operations defined in MyHandler via SOAP:
from ZSI import dispatch
from mod_python import apache
import MyHandler
mod = __import__('encodings.utf_8', globals(), locals(), '*')
mod = __import__('encodings.utf_16_be', globals(), locals(), '*')
def handler(req):
    dispatch.AsHandler(modules=(MyHandler,), request=req)
    return apache.OK
 |