views:

1719

answers:

3

Hi there, I have a problem with Python and SOAP. I need to create a web service based on SOAP in Python. I read that I can use libraries like soaplib, suds and ZSI. I created a Hello World web service with soaplib, like in documentation (http://trac.optio.webfactional.com/wiki/HelloWorld). The problem is that I cannot make a client for the web service which uses other than soaplib library. I wanted to do the client app using for example suds library in Python.

Did you managed to do an application in Python (for example with suds library) consuming the SOAP web service created with soaplib in Python?

+1  A: 

Are you asking whether it's possible to use (consume) a SOAP web service built with sth other than soaplib? That would of course be possible. Suds is good idea for this.

jellybean
okay, but I don't know how do it. I was looking for a tutorial or a simple example which shows how to consume soap web service created by soaplib with suds but I couldn't find it.
mw
Look at https://fedorahosted.org/suds/wiki/Documentation for a start. The stuff below "Basic usage" might help.
jellybean
A: 

How are you serving the service? soaplib produces a WSGI object, which needs to be served by a webserver. If you are following the helloworld example you link to then you are using CherryPy (a pure python web server) to host the service on your own machine. In the example the port is 7789 (but you can use anything you like). So if you use the example you should first start the script which runs cherrypy - this should stay running and not return to the prompt. When that is running you should be able to access your service at http://localhost:7789/wsdl - you can put that address in a web browser to see if it is working. Soaplib returns the wsdl as long as the url ends in wsdl - so in fact you can do http://localhost:7789/anythingherewsdl.

thrope
Very helpful! Thank you very much for your help.
mw
A: 

First of all, thanks for your help. I don't know why, but it seems that in my case the problem was with my web proxy. When I used code presented below I got HTTP Error 503: Service Unavailable

from suds.client import Client
client = Client("http://localhost:7789/wsdl")
print client

When I turned off that web proxy, that simple code worked successfully! Hopefully, I found a web page that presents a solution for this problem.

mw
You don't say what operating system you are on or how you have your proxy configured - but in most cases in your proxy configuration screen there is a setting like "No proxy for:" or "bypass proxy for:" and you should put localhost in there. Localhost is a special loopback address that points to your own computer, so if you put it through the proxy - it points to the computer the proxy is on.
thrope
You've got the point. I found an option "Exclude simple hostnames" and selected it. Now, everything works perfectly. Thanks for this hint.
mw