Conrad Steenberg
conrad at hep.caltech.edu
Sat Jun 26 09:44:26 EDT 2004
On Sat, 2004-06-26 at 08:36, Conrad Steenberg wrote: > Hi John > > I'm using this snippet in a mod_python-based server (clarens.sf.net): > > try: > import ZSI > from ZSI import ParsedSoap, SoapWriter, TC, ZSI_SCHEMA_URI, \ > FaultFromFaultMessage, _child_elements, Fault > except: > ZSI=None > > > try: > ps = ParsedSoap(data) Btw, "data" above is the message body received from the client. > method=ps.body_root.localName > arg_data = _child_elements(ps.body_root) > if len(arg_data) == 0: > arg = [] > else: > tc = TC.Any() > arg = [ tc.parse(e, ps) for e in arg_data ] > decoded=[str(method),arg] > except ZSI.ParseException, e: > write_response_soap(req,build_fault_soap_exception(req,e)) > return apache.OK > > > I.e. the method name would be in "method" and the arguments in "arg". I > don't know if this would work for a doc-style service... > > The two methods referenced in the exception handler are: > > def write_response_soap(req,message,code=apache.OK): > req.content_type='text/xml; charset="utf-8"' > req.headers_out['Server'] = "Clarens Apache/ZSI SOAP server %s"%_version > req.send_http_header() > req.write(message) > > and > > def build_fault_soap(req,call,code,message): > return ZSI.Fault(code,message).AsSOAP() > > Cheers > > Conrad > > On Fri, 2004-06-25 at 07:25, Ertl, John wrote: > > All, > > The all to common "I am new to mod_python". I have been using the ZSI SOAP > > module for a simple RPC style web service that uses AsCGI for the dispatch. > > I have been given the chance to work on a Virtual server that allows me to > > use mod_python without messing up everyone else. I have the simple example > > of mod_python and ZSI working but now I want to look at turning the RPC > > style web service into a doc-style service. What I can't figure out is how > > do I get to the soap body? If any of you are familiar with ZSI I assume I > > could use ParsedSoap but I am not sure what to do ParsedSoap on. Is there a > > better way to make a web service with mod_python? In the little I have > > read mod_python looks very promising but I just am just not able to link the > > pieces together. > > > > Any ideas or simple examples would be appreciated. > > Thanks, > > > > John Ertl > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > http://mailman.modpython.org/mailman/listinfo/mod_python -- Conrad Steenberg <conrad at hep.caltech.edu>
|