Search code examples
pythonsoapmod-wsgicherrypy

soaplib with mod_wsgi/cherrypy


I've followed the tutorials for setting up Apache with mod_wsgi to interface cherrypy and make a site running of it. This is my "myapp.wsgi", and opening http://localhost/ works great. Opening http://localhost/ape/ actually returns the text instead of a soap-response, and http://localhost/ape/service.wsdl returns a 500 HTTP error code. What am I doing wrong in getting such a simple SOAP service to run? How can I get it to return valid WSDL? My code follows below

Cheers

Nik

import atexit, threading, cherrypy,sys
from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import String, Integer, Array

sys.stdout = sys.stderr
cherrypy.config.update({'environment': 'embedded'})

class Root(object):
    def index(self):
        return 'Hello World!'
    index.exposed = True

    @soapmethod(_returns=String)
    def ape(self):
       return 'Ape!!'
    ape.exposed = True

application = cherrypy.Application(Root(), None)

Solution

  • I just tested this myself by replacing the last line of your file with

    cherrypy.quickstart(Root(), "/")
    

    and it worked just fine for me. I suggest trying this and seeing whether it works for you; if it does then you'll know that it's an issue relating to running it under Apache/mod_wsgi and not an inherent problem with your code.