Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python and SOAP [closed]

Tags:

python

soap

What is the best library that can be used to create a SOAP Server - Client with Python or implement client that can talk to SOAP Server ???

like image 755
ifixthat Avatar asked May 25 '11 08:05

ifixthat


People also ask

What is Python SOAP?

SOAP is a Web services technology favoured in certain environments. The following projects seek to support SOAP and related technologies such as WSDL: zeep (on PyPi) - Zeep is a modern and high performant SOAP client build on top of lxml and requests. It's well maintained, and compatible with Python 2 and 3.

Can we create SOAP API using Python?

If you're going to interact witha SOAP API you need a SOAP client to parse the WSDL url or else you won't be able to create a client to call like an RPC. Zeep is one that's available for Python. You can't just interact with it with CURL or something like that.


1 Answers

As for a SOAP client, my personal favourite is SUDS https://fedorahosted.org/suds/. It is very Pythonic and easy to use. Also you don't need to generate any code making it very useful for testing.

A simple example from its documentation (https://fedorahosted.org/suds/wiki/Documentation):

from suds.client import Client
url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
client = Client(url)

Now you can simply use client to call services. For instance in order to call getPercentBodyFat service (in the test case):

result = client.service.getPercentBodyFat('jeff', 68, 170)
print result

For more information about different SOAP libraries for Python, please see question 206154

like image 120
jsalonen Avatar answered Oct 31 '22 14:10

jsalonen