Missing last_sent() and last_received() methods in the Client class

Issue #39 new
Ezequiel Ruiz
created an issue

In the current development version of jurko-suds, I found that the last_sent() and last_received() methods of the Client class have been removed. The problem is that those methods allowed to inspect the RAW soap envelopes being sent and received to/from the web service. That feature was amazing for debugging purposes, and other kind of complex analysis.

Is it possible to add those methods again?, or any alternative to get those XML strings from the client class? It was one of the great features of suds! (at least for me, and I really need it).

Thanks in advance!

Comments (6)

  1. Jurko Gospodnetić repo owner

    Yup, I know about them and that functionality will be reinstanted, hopefully soon. I'd just like to define it property and add tests for it before that.

    If you really need them right now - it should be easy to revert the commit that removed them.

    The problem with them was that they were not really clear about which data they gave you - I think the data you got could have been processed by some, but not all of the plugins registered with suds.

    If you want to get the same functionality without making changes to suds-jurko, as it stands now - you can also register your plugin which should get the transported data at an appropriate level for the plugin you choose.

    Hope this helps.

    Best regards, Jurko Gospodnetić

  2. Ezequiel Ruiz reporter

    OK, I'll try with the plugin alternative for now, waiting for those methods being back on a future release.

    Thank you for your help Jurko!



  3. zhen tian

    waiting these methods back

    I added a plugin do the same thing:

    class LoggingWebServicePlugin(MessagePlugin):
        def __init__(self):
            self.last_sent_message = None
            self.last_received_reply = None
        def sending(self, context):
            if context.envelope:
                self.last_sent_message = context.envelope
        def parsed(self, context):
            if context.reply:
                self.last_received_reply = context.reply
        def last_sent(self):
            return self.last_sent_message
        def last_received(self):
            return self.last_received_reply

    when init your suds client, use plugins=[LoggingWebServicePlugin()]

  4. mistercorea@gmail.com

    @awncold, I have included MessagePlugin

    from suds.plugin import MessagePlugin
    from suds.client import Client

    and when i do initiate the client

    client = Client(wsdl, plugins=[LoggingWebServicePlugin()])

    does not work can you point me to right direction how you got it to work?

  5. zhen tian

    Hi @mistercorea@gmail.com , maybe my missing explain about function call.

    When you added the plugin to client, the plugin works same as a hook, so the plugin will get sent message and received reply, you should get these from plugin, not the client object.

    I init the plugin first and pass it to client, when I need last sent or last received, I call it from plugin.

    logging_plugin = LoggingWebServicePlugin()
    client = Client(url, plugins=[logging_plugin])
    # invoke a service
  6. Log in to comment