1、一些库的汇总信息:https://wiki.python.org/moin/WebServices 2、walker主要试用了suds 和 zeep,walker的Python版本为3.5.1。 【zeep】 zeep的pypi地址:https://pypi.python.org/pypi/zeep zeep的文档地址:http://docs.python-zeep.org/en/latest
1.针对非安全的http from zeep import Client url = "http://***? wsdl" from zeep import Client client = Client(url) result = client.service.getCircuit('11111') # getCircuit 'id': None, 'href': None, '_attr_1': { } } 2.针对安全的https from requests import Session from zeep import Client from zeep.transports import Transport url = "https://***? 可参考:https://python-zeep.readthedocs.io/en/master/index.html 本文参考:https://blog.csdn.net/Ohmyberry/article
祭出我们的大杀器,zeep. zeep是什么呢?就是python中用来解析SOAP格式的一个插件。具体怎么用,可以去官网看看。 import zeep, 然后用client发一下就可以了。 例如: import zeep host = “xx” member_id = “1145” wsdl = ‘http://{}.e.com/services/ecplatform/StudyPlanService.svc wsdl’.format(host) # client = zeep.Client(wsdl=wsdl, wsse=UsernameToken(‘SalesforceSmartUser’, ‘SalesforceSmartPwd ’)) client = zeep.Client(wsdl=wsdl) def join_group(): client.service.JoinGroup(studentId=member_id) def
方案三:借助zeep库调用 SOAP APIzeep库是 Python 中用于处理 SOAP 协议的库。 假设我们有一个 SOAP API 用于获取天气信息,下面是使用zeep库调用该 API 的示例代码。 首先,安装zeep库:pip install zeep代码如下:from zeep import Client# 设置WSDL文件的URL,WSDL文件描述了SOAP服务的接口wsdl_url = 'https GetWeatherweather_info = client.service.GetWeather(city='New York')print("纽约的天气信息:", weather_info)代码说明导入Client类:从zeep 创建 SOAP 客户端:使用Client(wsdl_url)创建一个 SOAP 客户端实例,zeep库会根据 WSDL 文件自动生成客户端代码,方便我们调用服务。
Alice”,“ Bob”), “ pets”:['Dog'], “ cars“:[ {” model“:” Audi A1“,” mpg“:15.1}, {” model“:” Zeep
python的SOAP程序库有SOAPpy, Zeep, ladon, suds-jurko, pysimplesoap, 这里只学习Zeep库,第三方库,同样要安装。 Zeep库用于wsdl文档,,会生成服务和文档代码。 import zeep w = 'http://www.soapclient.com/xml/soapresponder.wsdl' c = zeep.Client(wsdl=w) print(c.service.Method1
Python: suds-py3, zeep + pytest/unittest。.NET: WCF Client / HttpClient + XUnit/NUnit/MSTest。