[Soap-Python] deserialize without MethodContext in spyne
Burak Arslan
burak.arslan at arskom.com.tr
Sat Sep 22 14:30:12 CEST 2012
Hello,
The "right" way to do this is to implement a queue client/server
transport pair like in
https://github.com/plq/spyne/blob/08eb5137b948d1ba6c4526e1f2b3402f693d090a/examples/queue.py
The quick and dirty way would be to use ServerBase directly instead of
subclassing it, like here:
https://github.com/plq/spyne/blob/8a096fb1a32298b5375a1e3e0c8e93987c58958b/spyne/util/protocol.py#L26
Here's how you're supposed to use it:
https://github.com/plq/spyne/blob/8a096fb1a32298b5375a1e3e0c8e93987c58958b/spyne/test/test_util.py#L53
Does it help?
Best,
Burak
On 22/09/12 03:13, Jaakko Rytkönen wrote:
> 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
>
> ===============================================
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap
More information about the Soap
mailing list