[Soap-Python] deserialize without MethodContext in spyne
Jaakko Rytkönen
jaakko.rytkonen at gmail.com
Sat Sep 22 02:13:30 CEST 2012
Hi,
I'm using spyne for prototyping application and looking a simple way to
deserialize a soap string into python objects without using MethodContext.
I have writtten quite a lot handlers whitch are bound to python
instances and would like to be able to reuse those.
Maybe a simplified example is more describing:
===================================
# In a django view
class ProcessorService( ServiceBase ):
@rpc( StatusMessage, _returns = StatusResponse )
def set_statusmsg( ctx, srmsg ):
try:
result = processCommonPart(srmsg.common)
except ProcessingError:
raise
try:
result = processIndividuals(srmsg.indvidual)
except ProcessingError:
raise
return result
theservice = csrf_exempt( DjangoApplication( Application(
[ProcessorService],
tns = "the.process.service",
interface = Wsdl11(),
in_protocol = Soap11(),
out_protocol = Soap11(),
name = "ProcessorService",
) ) )
===============================================
# elsewhere
# retry processing caught (and saved) faulty soaprequests
def reprocess(soapstring):
# here I need the magic
soapobj = deserialize_soap(soapstring)
srmsg = soapobj.path.to.correct.elemnt.srmsg
# Use the same methods without hickups
try:
result = processCommonPart(srmsg.common)
except ProcessingError:
raise
try:
result = processIndividuals(srmsg.indvidual)
except ProcessingError:
raise
===============================================
More information about the Soap
mailing list