【发布时间】:2020-03-17 21:15:03
【问题描述】:
我一直在尝试使用 Zeep 生成 SOAP 信封以调用以下 WSDL 中的方法:
https://ws.conf.ebs.health.gov.on.ca:1443/EDTService/EDTService?wsdl
到目前为止,我想出了这个:
from zeep import Client, xsd
from zeep.transports import Transport
from requests import Session
import urllib3
from zeep.plugins import HistoryPlugin
urllib3.disable_warnings()
session = Session()
session.verify = False
transport = Transport(session=session)
history = HistoryPlugin()
client = Client(wsdl='https://ws.conf.ebs.health.gov.on.ca:1443/EDTService/EDTService?wsdl',
transport=transport, plugins=[history])
# client.wsdl.dump()
ebsheader = xsd.Element(
'{http://ebs.health.ontario.ca/}EBS',
xsd.ComplexType([
xsd.Attribute(
'Id',xsd.String()
),
xsd.Element(
'SoftwareConformanceKey', xsd.String()
),
xsd.Element(
'AuditId', xsd.String()
),
])
)
headers = []
headers.append(ebsheader('id-1','software-key-here','unique-id'))
response = client.service.getTypeList(_soapheaders=headers)
我离生成一个看起来像 API 规范中提供的示例的信封还差得很远。
作为 SOAP/WSDL 的新手,我很难理解超级复杂的 API 规范 http://www.health.gov.on.ca/en/pro/publications/ohip/docs/techspec_ebs.pdf
有没有人能够使用 Zeep 使用这个 API?
【问题讨论】:
-
你真正想做什么?生成信封还是要调用方法?
-
@Tarique 我想调用一个名为“getTypelist”的方法并最终调用“上传”
-
如果答案有效,请接受答案或在尝试后提供反馈。
-
@Tarique 我尝试使用您建议的方式调用该方法,但会导致 SSL 错误
标签: python soap wsdl soap-client zeep