I am using Spyne to implement a SOAP service.
I run this service using built-in wsgi server. Here is the code:
# Logging
import logging
logging.basicConfig(level=logging.DEBUG)
logging.raiseExceptions = 0
# Spyne imports
from spyne.application import Application
from spyne.decorator import srpc
from spyne.service import ServiceBase
from spyne.model.primitive import *
from spyne.model.complex import *
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
class HelloWorldService (ServiceBase):
@srpc(Unicode, _returns=Unicode)
def add_job(nfs_path):
print('Job added: {0}'.format(nfs_path))
return 'OK'
from wsgiref.simple_server import make_server
application = Application([HelloWorldService], tns='job.service',
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11())
wsgi_app = WsgiApplication(application)
server = make_server('0.0.0.0', 1369, wsgi_app)
server.serve_forever()
The problem is that this is not multithreaded, so it can't handle multiple clients. I googled a bit about this and I think I have to use apache/mod_wsgi with something like Django to have multithreaded/multiprocessed server. But that is a bit complex for my application.
I only need a web service, as light as possible with multithreading/multiprocessing. What choices do I have?
Thanks in advance
I can recommend Twisted and CherryPy which both offer decent Wsgi implementations.