用于同时处理多个请求的 SOAP 服务器的 Python 库?

发布于 2025-01-06 07:52:23 字数 438 浏览 0 评论 0原文

我正在寻找一个 python 库,用于轻松创建公开 Web 服务 (SOAP) 的服务器,并且可以同时处理多个请求。

我尝试过使用 ZSI 和 rcplib,但没有成功。

更新:
感谢您的回答。 ZSI 和 rcplib(soaplib 的后继者)都实现了自己的 Http 服务器。如何将 ZSI/rcplib 与您提到的库集成?

更新2:
经过一些调整,我成功地在 Linux 上安装并运行了它,并且看起来运行良好。
然后我在 Windows 上安装了它,经过很多丑陋的调整,然后我偶然发现 Windows 不支持 WSGIDaemonProcess(mod_wsgi 文档中也提到过)。无论如何,我尝试运行它,它似乎确实可以异步处理每个请求,但我不确定它在压力下是否能正常工作。

无论如何谢谢...

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

黎夕旧梦 2025-01-13 07:52:23

rpclib 的 Hello World 示例

请从 rpclib 示例中查看此内容

# 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()))

同时更改您的 apache 配置 根据

WSGIDaemonProcess example processes=5 threads=5
WSGIProcessGroup example

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

您的要求,您可以更改进程和线程。

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.

话少情深 2025-01-13 07:52:23

抱歉,可能是我没理解你的意思。

我认为您希望服务器并行处理 HTTP 请求,但是您不需要考虑您的代码/库。并行化应该由 Apache httpd 和 mod_wsgi/mod_python 模块完成。

只需设置 httpd.conf 为“MaxClients 100”,例如“WSGIDaemonProcess webservice paths=1threads=100”。

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.

青衫儰鉨ミ守葔 2025-01-13 07:52:23

您可以使用 soaplib 来开发您的肥皂服务。要将该服务公开给其他人,您可以使用 Apache 和 mod_wsgi 模块。要设置多线程或多处理,您可以在 mod_wsgi 中设置参数

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文