Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I dump raw XML of my request and server's response using suds in python

Tags:

python

soap

suds

i'm using suds 0.4 and python 2.6, to communicate with remote server.

It's WSDL loads perfectly, but any function call returns error. Something is wrong with that server.

Now i need to get a dump of soap structure, that is sent to server and it's response, in pure soap either.

How can i do that?

like image 629
gistart Avatar asked Nov 24 '10 10:11

gistart


People also ask

What is suds in Python?

Suds is a SOAP module for Python, which allows Python to consume wsdl files. Setuptools that you installed in the previous step includes an Easy Install program that you can use to install the correct version of suds. Download the suds egg from https://pypi.python.org/pypi/suds.

What is suds package?

Suds is a lightweight SOAP-based web service client for Python licensed under LGPL (see the LICENSE. txt file included in the distribution).

What is suds object?

Suds is a lightweight library that uses SOAP based clients for python. SOAP is an RPC (Remote Procedure Call) that uses object-oriented protocol. Suds is actually lightweight SOAP python client that provides a service proxy for web services.


1 Answers

Setting the logging for suds.transport to debug will get you the sent and received messages.

For an interactive session, I find this is good:

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)

from suds.client import Client
s = Client('http://someservice?wsdl')

For specifically just the sent and received XML sent to a file, you'll need to play with the logging settings, see http://docs.python.org/library/logging.html

like image 190
MattH Avatar answered Sep 27 '22 19:09

MattH