标签归档:soap-client

有哪些适用于Python的SOAP客户端库,它们的文档在哪里?[关闭]

问题:有哪些适用于Python的SOAP客户端库,它们的文档在哪里?[关闭]

我以前从未使用过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.


回答 0

更新(2016):

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


更新:

除了上面提到的内容外,我还将参考Python WebServices页面,该页面始终是最新的,其中包含针对SOAP和所有其他Webservice类型的所有主动维护和推荐的模块。


不幸的是,目前,我认为没有“最好的” Python SOAP库。每种主流产品都有其优点和缺点。

较旧的库:

  • SOAPy:是“最佳”的,但不再维护。在Python 2.5+上不起作用

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

“较新的”库:

  • SUDS:非常Pythonic,易于创建消耗WSDL的SOAP客户端。创建SOAP服务器要困难一些。(此软件包不适用于Python3。有关Python3,请参见SUDS-py3)

  • SUDS-py3SUDS的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.


回答 1

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

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

urllib2python 2.6.2及更低版本附带的模块不会CONNECT向HTTPS-over-HTTP-proxy会话的代理发出。这将导致超时,或者如果您幸运的话,将出现以下错误:

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

这是Python错误跟踪器上的issue1424152。错误报告附带有补丁程序,可在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.


回答 2

我对SUDS https://fedorahosted.org/suds有很好的经验

使用他们的TestSuite作为文档。

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

Used their TestSuite as documentation.


回答 3

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

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


回答 4

只是针对查看SUDS的人员提供的FYI警告,在此票证解决之前,SUDS不支持WSDL中的“ choice”标签:

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


回答 5

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.


回答 6

我们发布了一个新的库: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.


回答 7

我相信soaplib已弃用其SOAP客户端(“发送者”),而改为使用肥皂水。在这一点上,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


回答 8

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

肥皂客户端:

使用Suds-jurko (2016年更新) 可以很好地维护和更新泡沫。

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

我测试ZEEP库,但得到周围令牌的限制,现在只支持用户名令牌,我报告一个错误创建时间戳标记和作者更新的代码来修复它。

Zeep的启动良好,并且具有良好的文档,因此我最近将代码从suds迁移到了zeep,并且运行良好。

肥皂服务器端:

我们有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,


回答 9

正如我在这里建议的那样我建议您自己滚动。实际上并不是那么困难,我怀疑这就是那里没有更好的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.


回答 10

泡沫非常好。我尝试了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.


回答 11

能否提供帮助:http : //users.skynet.be/pascalbotte/rcx-ws-doc/python.htm#SOAPPY

我通过搜索wsdland来找到它,python从本质上讲,您将需要对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….


回答 12

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

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


回答 13

我在生产环境中将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.