How can I output what SUDs is generating/receiving?

alfredo picture alfredo · Dec 13, 2010 · Viewed 37k times · Source

I have the following code:

from suds.client import Client
import logging

logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)

SB_PRIVATE_ACCESS = {"PATH":"https://thisurl.com:443/services/",}

client = Client(SB_PRIVATE_ACCESS['PATH'])
print client

but I am getting 500 errors. I am trying to send what XML is being generated and received through SUDs, to the wsdl developer, but I can't figure how to output it? I have been looking in the documentation of SUDs, but can't seem to find it :/ Does anyone know how to output the raw xml that is sent and received?

Answer

olly_uk picture olly_uk · May 20, 2011

SUDS provides some convenience methods to do just that:

 client.last_sent()
 client.last_received()

These should provide you with what you need. I use them for error logging. The API doc for Client class should have any extra info you need.