Python 有哪些 SOAP 客户端库,它们的文档在哪里?

发布于 2024-07-06 23:24:43 字数 409 浏览 7 评论 0原文

我以前从未使用过 SOAP ,而且我对 Python 还算陌生。 我这样做是为了让自己熟悉这两种技术。 我已经安装了 SOAPlib 并且我尝试阅读他们的 Client 文档,但我不太理解它。 还有什么我可以研究的更适合作为 Python 的 SOAP 客户端库吗?

编辑:以防万一它有帮助,我正在使用 Python 2.6。

I've never used SOAP before and I'm sort of new to Python. I'm doing this to get myself acquainted with both technologies. I've installed SOAPlib and I've tried to read their Client documentation, but I don't understand it too well. Is there anything else I can look into which is more suited for being a SOAP Client library for Python?

Edit: Just in case it helps, I'm using Python 2.6.

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

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

发布评论

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

评论(14

枉心 2024-07-13 23:24:44

更新(2016):

如果您只需要 SOAP 客户端,有一个维护良好的库,名为 zeep。 它支持 Python 2 和 3 :)


更新:

除了上面提到的内容之外,我还将参考 Python WebServices 页面始终保持最新,包含 SOAP 和所有其他 Web 服务类型的所有积极维护和推荐的模块。


不幸的是,目前我不认为存在“最好的”Python SOAP 库。 每个可用的主流都有其自身的优点和缺点。

较旧的库:

  • SOAPy:是“最好的”,但不再维护。 不适用于 Python 2.5+

  • ZSI:使用起来非常痛苦,而且开发速度很慢。 有一个名为“SOAPpy”的模块,它与 SOAPy(上面)不同。

“较新”的库:

  • SUDS:非常 Pythonic,并且易于创建使用 WSDL 的 SOAP 客户端。 创建 SOAP 服务器稍微困难一些。 (此包不适用于 Python3。对于 Python3,请参阅 SUDS-py3)

  • SUDS-py3:SUDS 的 Python3 版本

  • spyne:创建服务器很容易,创建客户端有点困难。 文档有些缺乏。

  • ladon:创建服务器很像在soaplib中(使用装饰器)。 Ladon 同时公开了比 SOAP 更多的接口,无需额外的用户代码。

  • pysimplesoap:非常轻量级,但对客户端和服务器都很有用 - 包括 web2py 服务器集成随 web2py 一起提供。

  • SOAPpy:与上面 ZSI 链接托管的废弃 SOAPpy 不同,该版本实际上一直维护到 2011 年,现在好像也被放弃了。
  • soaplib:易于使用的Python库,用于编写和调用soap Web服务。 使用soaplib 编写的Web 服务简单、轻量,可以与其他SOAP 实现很好地配合,并且可以部署为WSGI 应用程序。
  • osa:一个快速/精简且易于使用的 SOAP python 客户端库。

其中,我个人只使用过SUDS,并且非常喜欢它。

Update (2016):

If you only need SOAP client, there is well maintained library called zeep. It supports both Python 2 and 3 :)


Update:

Additionally to what is mentioned above, I will refer to Python WebServices page which is always up-to-date with all actively maintained and recommended modules to SOAP and all other webservice types.


Unfortunately, at the moment, I don't think there is a "best" Python SOAP library. Each of the mainstream ones available has its own pros and cons.

Older libraries:

  • SOAPy: Was the "best," but no longer maintained. Does not work on Python 2.5+

  • ZSI: Very painful to use, and development is slow. Has a module called "SOAPpy", which is different than SOAPy (above).

"Newer" libraries:

  • SUDS: Very Pythonic, and easy to create WSDL-consuming SOAP clients. Creating SOAP servers is a little bit more difficult. (This package does not work with Python3. For Python3 see SUDS-py3)

  • SUDS-py3: The Python3 version of SUDS

  • spyne: Creating servers is easy, creating clients a little bit more challenging. Documentation is somewhat lacking.

  • ladon: Creating servers is much like in soaplib (using a decorator). Ladon exposes more interfaces than SOAP at the same time without extra user code needed.

  • pysimplesoap: very lightweight but useful for both client and server - includes a web2py server integration that ships with web2py.

  • SOAPpy: Distinct from the abandoned SOAPpy that's hosted at the ZSI link above, this version was actually maintained until 2011, now it seems to be abandoned too.
  • soaplib: Easy to use python library for writing and calling soap web services. Webservices written with soaplib are simple, lightweight, work well with other SOAP implementations, and can be deployed as WSGI applications.
  • osa: A fast/slim easy to use SOAP python client library.

Of the above, I've only used SUDS personally, and I liked it a lot.

深空失忆 2024-07-13 23:24:44

我遵循了这个问题的其他答案的建议,并尝试了 SUDS 。 在“愤怒地”使用它之后,我必须同意:SUDS 非常好! 强烈推荐!

我确实在从代理后面调用基于 HTTPS 的 Web 服务时遇到了麻烦。 在撰写本文时,这会影响使用 urllib2所有 Python Web 服务客户端,因此我将在此处记录该解决方案。

随 python 2.6.2 及更低版本一起提供的 urllib2 模块不会向 HTTPS-over-HTTP 代理会话的代理发出 CONNECT。 这会导致长时间超时,或者如果幸运的话,会出现如下错误:

abort: error: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

This was issue1424152 on Python 错误跟踪器。 错误报告中附加了一些补丁,可以在 Python 2.x 和 Python 3.x 中修复此问题。 问题已修复

I followed the advice of other answers to this question and gave SUDS a try. After using it "in anger" I must agree: SUDS is very nice! Highly recommended!

I did run into trouble calling HTTPS-based web services from behind a proxy. At the time of this writing, this affects all Python web-service clients that use urllib2, so I'll document the solution here.

The urllib2 module shipping with python 2.6.2 and below will not issue a CONNECT to the proxy for HTTPS-over-HTTP-proxy sessions. This results in a long timeout, or if you are lucky, an error that looks like:

abort: error: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

This was issue1424152 on the Python bug tracker. There are patches attached to the bug report that will fix this in Python 2.x and Python 3.x. The issue is already fixed.

深居我梦 2024-07-13 23:24:44

我在 SUDS 方面有很好的经验
https://fedorahosted.org/suds

使用他们的 TestSuite 作为文档。

I had good experience with SUDS
https://fedorahosted.org/suds

Used their TestSuite as documentation.

新雨望断虹 2024-07-13 23:24:44

SUDS 是必经之路,这是毫无疑问的。

SUDS is the way to go, no question about it.

ゝ偶尔ゞ 2024-07-13 23:24:44

对于查看 SUDS 的人来说,仅供参考,在解决此问题之前,SUDS 不支持 WSDL 中的“选择”标签:

https://fedorahosted.org/suds/ticket/342

参见:
泡沫和选择标签

Just an FYI warning for people looking at SUDS, until this ticket is resolved, SUDS does not support the "choice" tag in WSDL:

https://fedorahosted.org/suds/ticket/342

see:
suds and choice tag

难忘№最初的完美 2024-07-13 23:24:44

SUDS 易于使用,但不保证可重入。 如果您将 WSDL Client() 对象保留在线程应用程序中以获得更好的性能,则存在一些风险。 解决这个风险的方法是clone()方法,它会抛出不可恢复的Python 5508错误,该错误似乎会打印但实际上并没有抛出异常。 可能会令人困惑,但它确实有效。 它仍然是迄今为止最好的 Python SOAP 客户端。

SUDS is easy to use, but is not guaranteed to be re-entrant. If you're keeping the WSDL Client() object around in a threaded app for better performance, there's some risk involved. The solution to this risk, the clone() method, throws the unrecoverable Python 5508 bug, which seems to print but not really throw an exception. Can be confusing, but it works. It is still by far the best Python SOAP client.

春风十里 2024-07-13 23:24:44

我们发布了一个新库:PySimpleSOAP,它为简单而实用的客户端/服务器提供支持。 它的目标是:易用性和灵活性(不需要类、自动生成的代码或 xml)、WSDL 自省和生成、WS-I 标准合规性、兼容性(包括 Java AXIS、.NET 和 Jboss WS)。 它包含在 Web2Py 中以实现全栈解决方案(补充其他支持的协议,例如 XML_RPC、JSON、AMF-RPC 等)。

如果有人正在学习 SOAP 或者想研究它,我认为这是一个不错的开始选择。

We released a new library: PySimpleSOAP, that provides support for simple and functional client/server. It goals are: ease of use and flexibility (no classes, autogenerated code or xml is required), WSDL introspection and generation, WS-I standard compliance, compatibility (including Java AXIS, .NET and Jboss WS). It is included into Web2Py to enable full-stack solutions (complementing other supported protocols such as XML_RPC, JSON, AMF-RPC, etc.).

If someone is learning SOAP or want to investigate it, I think it is a good choice to start.

苦笑流年记忆 2024-07-13 23:24:44

我相信soaplib 已弃用其SOAP 客户端(“发送者”),转而使用suds。 此时,soaplib 专注于成为与 Web 框架无关的 SOAP 服务器(“接收器”)。 目前,soaplib 正在积极开发中,通常在 Python SOAP 邮件列表中进行讨论:

http://mail .python.org/mailman/listinfo/soap

I believe soaplib has deprecated its SOAP client ('sender') in favor of suds. At this point soaplib is focused on being a web framework agnostic SOAP server ('receiver'). Currently soaplib is under active development and is usually discussed in the Python SOAP mailing list:

http://mail.python.org/mailman/listinfo/soap

憧憬巴黎街头的黎明 2024-07-13 23:24:44

在我的结论中,我们有这样的结论:

Soap 客户端:

仅使用 Suds-jurko (2016 年更新)
suds 维护和更新得很好。

更新 06/2017: suds-jurko 库未更新,显然已被放弃

我测试了 zeep 库,但对令牌有限制,现在只支持 UsernameToken,我报告了 bug 创建时间戳令牌,作者更新代码来修复它。

Zeep 启动良好并且具有良好的 文档 ,所以我最近迁移了我的代码从泡沫到泽普,效果都很好。

Soap 服务器端:

我们有 TGWS、soaplib(pysimplesoap 未测试)恕我直言,使用和帮助 soaplib 必须是选择。

最诚挚的问候,

In my conclusion we have this:

Soap client side:

use only Suds-jurko (updated 2016)
suds is well maintained and updated.

UPDATE 06/2017: suds-jurko library is not updated and apparently abandoned,

I tested zeep library but got limitations around tokens, by now just support UsernameToken, i report a bug to create timestamp token and author update the code to fix it.

Zeep start good and has good documentation , so i recently migrated my code from suds to zeep and works fine.

Soap server side:

We have TGWS, soaplib (pysimplesoap not tested) IMHO use and help soaplib must be the choice.

Best regards,

北音执念 2024-07-13 23:24:44

正如我建议的此处我建议你自己动手。 实际上并没有那么困难,我怀疑这就是没有更好的 Python SOAP 库的原因。

As I suggested here I recommend you roll your own. It's actually not that difficult and I suspect that's the reason there aren't better Python SOAP libraries out there.

帅气尐潴 2024-07-13 23:24:44

肥皂水很不错。 我尝试了 SOAPpy,但没有让它按照我需要的方式工作,而肥皂水几乎可以立即工作。

suds is pretty good. I tried SOAPpy but didn't get it to work in quite the way I needed whereas suds worked pretty much straight away.

情未る 2024-07-13 23:24:44

这可以帮助吗: http://users.skynet.be/ pascalbotte/rcx-ws-doc/python.htm#SOAPPY

我通过搜索 wsdlpython 找到了它,理性的是,你需要SOAP 服务器的 wsdl 描述,用于执行任何有用的客户端包装......

Could this help: http://users.skynet.be/pascalbotte/rcx-ws-doc/python.htm#SOAPPY

I found it by searching for wsdl and python, with the rational being, that you would need a wsdl description of a SOAP server to do any useful client wrappers....

じее 2024-07-13 23:24:44

我们使用了 Python Web Services 中的 SOAPpy,但似乎 ZSI(相同来源)正在取代它。

We'd used SOAPpy from Python Web Services, but it seems that ZSI (same source) is replacing it.

再可℃爱ぅ一点好了 2024-07-13 23:24:44

我在生产环境中使用 SOAPpy 和 Python 2.5.3。

我必须在 SOAPpy 中手动编辑几个文件(有关标头代码位于错误位置的信息),但除此之外它可以工作并且继续非常可靠地工作。

Im using SOAPpy with Python 2.5.3 in a production setting.

I had to manually edit a couple of files in SOAPpy (something about header code being in the wrong place) but other than that it worked and continues to do so very reliably.

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