1

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?

mw.
  • 13
  • 1
  • 4
  • Yes, I have made a web service using soaplib that I could consume from suds (and many other clients). Without more information about what problems you are having its difficult to say anything else. – robince Nov 17 '09 at 19:35
  • It's good to hear :) Below is the piece of code which uses suds and my problem is that I don't know what URL should I use. I got responses like 503 snd 504.   from suds.client import Client  client=Client(URL) print client – mw. Nov 17 '09 at 20:21

2 Answers2

2

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.

robince
  • 10,826
  • 3
  • 35
  • 48
  • 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](http://blog.finalhaven.org/2009/01/making-suds-not-use-proxy.html). – mw. Nov 18 '09 at 01:44
  • 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. – robince Nov 18 '09 at 10:04
  • You've got the point. I found an option "Exclude simple hostnames" and selected it. Now, everything works perfectly. Thanks for this hint. – mw. Nov 18 '09 at 12:45
1

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

Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
Johannes Charra
  • 29,455
  • 6
  • 42
  • 51