1

I'm looking for a python library for easily creating a server which exposes web services (SOAP), and can process multiple requests simultaneously.

I've tried using ZSI and rcplib, but with no success.

Update:
Thanks for your answers. Both ZSI and rcplib (the successor of soaplib) implement their own Http server. How do I integrate ZSI/rcplib with the libraries you mentioned?

Update2:
After some tweaking, I managed to install and run this on linux, and it seems to work well.
Then I installed it on windows, after a lot of ugly tweakings, and then I stubmled upon the fact that WSGIDaemonProcess isn't supported in windows (also mentioned in mod_wsgi docs). I tried to run it anyway, and it does seems to work on each request asynchronicly, but I'm not sure it will work well under pressure.

Thanks anyway...

3 Answers 3

1

Hello World example of rpclib

Please check this from rpclib example

# File /home/myhome/test.wsgi
import logging

from rpclib.application import Application
from rpclib.decorator import srpc
from rpclib.interface.wsdl import Wsdl11
from rpclib.protocol.soap import Soap11
from rpclib.service import ServiceBase
from rpclib.model.complex import Iterable
from rpclib.model.primitive import Integer
from rpclib.model.primitive import String
from rpclib.server.wsgi import WsgiApplication

class HelloWorldService(ServiceBase):
    @srpc(String, Integer, _returns=Iterable(String))
    def say_hello(name, times):
        '''
        Docstrings for service methods appear as documentation in the wsdl
        <b>what fun</b>
        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''

        for i in xrange(times):
            yield 'Hello, %s' % name

application = WsgiApplication(Application([HelloWorldService], 'rpclib.examples.hello.soap',
                interface=Wsdl11(), in_protocol=Soap11(), out_protocol=Soap11()))

Also change your apache config as

WSGIDaemonProcess example processes=5 threads=5
WSGIProcessGroup example

WSGIScriptAlias / /home/myhome/test.wsgi
<Directory /home/myhome/>
Order deny,allow
Allow from all
</Directory>

As per your requirement you can change the processes and threads.

1

Excuse me, may be I didn't understand you right.

I think that you want your server to process HTTP requests in parallel, but then you don't need to think about your code/library. Parallelizing should be done by Apache httpd and mod_wsgi/mod_python module.

Just set up httpd.conf with 'MaxClients 100' for example and 'WSGIDaemonProcess webservice processes=1 threads=100' for example.

4
  • I've updated my question. Please update your answer as well :)
    – wafwaf
    Feb 16, 2012 at 14:52
  • 1
    Bad idea blindly setting threads to 100 like that. Too many threads like that and you can actually hamper the performance. Should use more processes with less threads. Feb 17, 2012 at 0:53
  • @GrahamDumpleton thank you, Graham. I used processes=1 threads=150 for my application, but then tried processes=5 threads=30 and it works much better with clients>150
    – wobmene
    Feb 20, 2012 at 11:29
  • Unless you have long requests, you can actually serve 150 clients on a lot less threads than that even. This is because when requests are quite short, they aren't going to overlap with the other 149 clients. So they can interleave with each other and utilise a lot less threads. See for example plus.google.com/114657481176404420131/posts/G1jM6WW3Pnu In that case I ramped up to 150 clients from memory and handled it with 9 threads. Take note of what I am saying about thread utilisation in that post and how as they increases start to see queuing time increase. Feb 20, 2012 at 23:20
1

You can use soaplib to develop your soap service. To expose that service to other you can use Apache and mod_wsgi module. To set it multithreading or multiprocessing you can set the parameter in mod_wsgi

1
  • I've updated my question. Please update your answer as well :)
    – wafwaf
    Feb 16, 2012 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.