Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I write a SOAP server using python suds?

I started using suds for soap clients and will never touch ZSI again.

I know suds is meant for the client side, but I would love to use it to make also the server site, in order to get rid of ZSI.

How could I use suds to parse soap requests instead of responses?

[updates]

  • If you want to expose some interface using SOAP, the best option seems to be rpclib. Flask-enterprise looks promising. Both will produce a WSDL from Python code.
  • If instead you need to write a Python SOAP webservice adhering to a WSDL produced by a third part, nothing so far beats ZSI.
like image 360
Unpaid Oracles Avatar asked Jan 14 '12 02:01

Unpaid Oracles


People also ask

Can we create SOAP API using Python?

SOAP stands for Simple Object Access Protocol, as the name suggests nothing but a protocol for exchanging structured data between nodes. It uses XML instead of JSON.

Does Python support SOAP?

Python Web Services and Zolera Soap Infrastructure ((ZSI on PyPi) provides both client and server SOAP libraries.

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.

How do I make a SOAP request in Python?

To make SOAP requests to the SOAP API endpoint, use the "Content-Type: application/soap+xml" request header, which tells the server that the request body contains a SOAP envelope. The server informs the client that it has returned a SOAP envelope with a "Content-Type: application/soap+xml" response header.


2 Answers

To write a SOAP server in Python, you can use the micro web framework - Flask, with it's plugin - Flask-enterprise

http://massive.immersedcode.org/2011/staging/projects/default/python/flask-enterprise/

There is also a similar question here in stackoverflow:

Python soap using soaplib (server) and suds (client)

They use soaplib for providing SOAP service, as you can find the document here http://soaplib.github.com/soaplib/2_0/pages/helloworld.html

like image 103
Fang-Pen Lin Avatar answered Oct 16 '22 13:10

Fang-Pen Lin


If you decided to use Flask - try new flask-spyne extension.

flask-enterprise mentioned above is a wrapper on top of discontinued soaplib, while flask-spyne is a wrapper on top of spyne - successor of soaplib.

like image 34
ARA1307 Avatar answered Oct 16 '22 15:10

ARA1307