我在网上搜索了一个现有的,支持Python 3的 SOAP库.(客户端和服务器)
这里是我找到的库列表:
Python 2:
Python 3:
这个列表对你来说似乎完整吗?(仅供参考,我使用这篇文章作为起点(该帖子的目的是相同的,但对于Python 2而言))
Ladon在我看来是Python 3唯一现有的框架,但AFAIK只能用于实现服务器端.
NO:我不想自己迁移其中一个已停产的Python 2项目.我正在寻找一个受支持的项目,如果需要,我们会派出一个积极的团队提
更新于28/09/2013
我目前正在研究实现一个将使用现有广泛的SOAP管理API的客户端.
我研究了不同的SOAP实现,如pysimplesoap和SUDS.虽然第一个因为递归太多而解析WSDL时遇到问题,但是suds工作得很好(但很慢)而且我真的很喜欢模块.
但是,SUDS似乎存在一些问题,例如高内存消耗,WSDL解析速度以及缺少对某些WSDL属性的支持(例如,选择属性).
虽然有很多人积极提交错误报告和补丁,但自2010-09-15以来没有发布过SUDS.此外,维基和路线图看起来有点被忽视.
对我来说,看起来SUDS已不再维护.
所以我的问题在这里:
[2013年11月更新]
两年多过去了,事实证明原来的肥皂水泥项目真的已经死了.自2010年以来,没有进一步的版本.由于这一事实,很多人开始分支suds,而像Debian这样的发行版正在部署原始suds包的修补版本来修复一些问题.
我可以推荐Jurko积极维护的叉子,我成功使用了它.它支持python 3并解决了很多泡沫已知的问题.Bitbucket上提供了发行说明和错误跟踪器,PyPI上也提供了该程序包,因此可以使用pip进行安装.
我有以下代码:
from suds.client import Client
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
SB_PRIVATE_ACCESS = {"PATH":"https://thisurl.com:443/services/",}
client = Client(SB_PRIVATE_ACCESS['PATH'])
print client
Run Code Online (Sandbox Code Playgroud)
但我得到了500个错误.我试图通过SUD将生成和接收的XML发送给wsdl开发人员,但我无法想出如何输出它?我一直在查看SUD的文档,但似乎无法找到它:/有谁知道如何输出发送和接收的原始xml?
从suds 文档中,我可以创建一个Client如果我有一个WSDL的URL.
from suds.client import Client
url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
client = Client(url)
Run Code Online (Sandbox Code Playgroud)
我目前在我的文件系统上有WSDL文件.是否可以使用suds从我的文件系统读取WSDL文件而不是在Web服务器上托管它?
尝试使用pip-3.2安装suds并且它因错误而失败
sudo pip-3.2 install suds
Downloading/unpacking suds
Running setup.py egg_info for package suds
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build/suds/setup.py", line 20, in <module>
import suds
File "suds/__init__.py", line 154, in <module>
import client
ImportError: No module named client
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build/suds/setup.py", line 20, in <module>
import suds
File "suds/__init__.py", line 154, in <module>
import client
ImportError: …Run Code Online (Sandbox Code Playgroud) 我在Apache下使用ssl进行soap服务,suds使用gres而不使用ssl.
我有客户端证书(my.crt和user.p12文件).
我需要如何配置suds客户端以使其与https服务一起使用?
没有证书,我明白了
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:499: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure>
我正在尝试使用python签署带有证书的SOAP请求.我Signature用py-wsse 尝试了python-zeep及其方法和suds .两者都没有给我预期的结果.
Zeep给了我:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap-env:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#id-2790286f-721f-4f62-88bf-7e6b1f160e09">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue> DATA </DigestValue>
</Reference>
<Reference URI="#id-597e9b96-07e2-4ee8-9ba8-071d97851456">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue> DATA </DigestValue>
</Reference>
</SignedInfo>
<SignatureValue> DATA </SignatureValue>
<KeyInfo>
<wsse:SecurityTokenReference><X509Data>
<X509IssuerSerial>
<X509IssuerName> DATA </X509IssuerName>
<X509SerialNumber> DATA </X509SerialNumber>
</X509IssuerSerial>
<X509Certificate> DATA </X509Certificate>
</X509Data>
</wsse:SecurityTokenReference></KeyInfo>
</Signature>
<wsu:Timestamp wsu:Id="id-597e9b96-07e2-4ee8-9ba8-071d97851456">
<wsu:Created>2017-10-27T09:41:01+00:00</wsu:Created>
<wsu:Expires>2017-10-27T10:41:01+00:00</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap-env:Header>
<soap-env:Body wsu:Id="id-2790286f-721f-4f62-88bf-7e6b1f160e09">
<wst:RequestSecurityToken>
<wst:TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</wst:TokenType>
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>
</wst:RequestSecurityToken>
</soap-env:Body>
</soap-env:Envelope>
Run Code Online (Sandbox Code Playgroud)
虽然suds …
我正在调查SUDS作为python的SOAP客户端.我想检查指定服务中可用的方法,以及指定方法所需的类型.
目的是生成用户界面,允许用户选择方法,然后以动态生成的形式填写值.
我可以获得有关特定方法的一些信息,但我不确定如何解析它:
client = Client(url)
method = client.sd.service.methods['MyMethod']
Run Code Online (Sandbox Code Playgroud)
我无法编程以 确定我需要创建哪种对象类型才能调用该服务
obj = client.factory.create('?')
res = client.service.MyMethod(obj, soapheaders=authen)
Run Code Online (Sandbox Code Playgroud)
有没有人有一些示例代码?
我目前正在使用web toolkitpython,我必须进行大量的SOAP调用.对我来说不幸的是,有几个电话使用MTOM.我目前正在使用SUDS,我想知道是否可以用它进行MTOM调用(我在文档中找不到任何内容,所以我认为答案是否定的).
如果SUDS不是解决方案,还有其他选择吗?
我第一次使用最新版本的suds(https://fedorahosted.org/suds/),我在第一步停滞不前.
suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'
Run Code Online (Sandbox Code Playgroud)
现在,我知道这在泡沫世界中有很好的覆盖面(https://fedorahosted.org/suds/wiki/TipsAndTricks#Schema-TypeNotFound和Python/Suds:未找到类型:'xs:complexType')但这似乎是略有不同,因为(a)模式应该在版本0.3.4之后自动绑定,并且(b)即使显式使用变通方法,它仍然不起作用.
from suds.client import Client
from suds.xsd.sxbasic import Import
url = 'file:wsdl.wsdl'
Import.bind('http://schemas.xmlsoap.org/soap/encoding/')
client = Client(url, cache = None)
Run Code Online (Sandbox Code Playgroud)
与wsdl:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://ws.client.com/Members.asmx"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://ws.client.com/Members.asmx"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://ws.client.com/Members.asmx">
<s:element name="GetCategoriesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCategoriesResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
</wsdl:definitions>
Run Code Online (Sandbox Code Playgroud)
产生上述例外.