22.09.2012 15:30, Burak Arslan kirjoitti:
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?

Thank you. It did, although I managed to confuse @rpc and @srpc usage (again). Thanks again for providing example for more sustainable solution in the future.

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
[email protected]
http://mail.python.org/mailman/listinfo/soap


_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to