Zeep 的 SOAP 请求 (Python)
SOAP request with Zeep (Python)
我正在尝试使用 python 中的 zeep 模块发送 SOAP 请求。
python -mzeep XXXXXXXX.wsdl
returns 以下:
前缀:
xsd: http://www.AA.org/2003/XMLSchema
ns0: http://www.bbbb.com/PM/BLS
全局元素:
ns0:GetBalReq(header: ns0:RequestHeader, custId: xsd:string, customAvpList: ns0:AttributeValuePairList)
ns0:GetBalResp(nalId: xsd:string, custId: xsd:string, custRole: xsd:string, nalType: xsd:string, bal: ns0:BalDetailsList, customAvpList: ns0:AttributeValuePairList)
全局类型:
xsd:anyType
ns0:AttributeValuePair(attribute: xsd:string, value: xsd:string)
ns0:AttributeValuePairList(item: ns0:AttributeValuePair[])
ns0:BalDetailsList(item: ns0:BalDetails[])
ns0:RequestHeader(auditInfo: xsd:string, transactionId: xsd:string)
xsd:string
绑定:
Soap11Binding: {http://www.bbbb.com/PM/BLS}BLS
服务:BLS
Port: BLS (Soap11Binding: {http://www.bbbb.com/PM/BLS}BLS)
Operations:
getBalReq(header: ns0:RequestHeader, custId: xsd:string, customAvpList: ns0:AttributeValuePairList) -> nalId: xsd:string, custId: xsd:string, custRole: xsd:string, nalType: xsd:string, bal: ns0:BalDetailsList, customAvpList: ns0:AttributeValuePairList
只需关注:
from zeep import Client
client = Client('XXXXXXXX.wsdl')
client.service.getBalReq(custId='12345678')
我收到以下错误:
"Missing element %s" % (self.name), path=render_path
zeep.exceptions.ValidationError: Missing element header (GetBalReq.header)
最近 2 天我一直在绞尽脑汁如何使这项工作正常进行,如何发送正确的请求以获得有效响应,阅读 zeep 文档、论坛等,但就是想不通。知道正确的代码吗?
您必须将参数 'header' 传递给方法 'getBalReq',如下所示。
from zeep import Client
client = Client('XXXXXXXX.wsdl')
header_request = client.get_type('ns0:RequestHeader')
header = header_request(auditInfo = your_auditInfo,transactionId = your_transactionId)
client.service.getBalReq(header=header, custId='12345678', customAvpList = your_customAvpList)
如果customAvpList是可选参数,可以忽略。
我正在尝试使用 python 中的 zeep 模块发送 SOAP 请求。 python -mzeep XXXXXXXX.wsdl returns 以下:
前缀:
xsd: http://www.AA.org/2003/XMLSchema
ns0: http://www.bbbb.com/PM/BLS
全局元素:
ns0:GetBalReq(header: ns0:RequestHeader, custId: xsd:string, customAvpList: ns0:AttributeValuePairList)
ns0:GetBalResp(nalId: xsd:string, custId: xsd:string, custRole: xsd:string, nalType: xsd:string, bal: ns0:BalDetailsList, customAvpList: ns0:AttributeValuePairList)
全局类型:
xsd:anyType
ns0:AttributeValuePair(attribute: xsd:string, value: xsd:string)
ns0:AttributeValuePairList(item: ns0:AttributeValuePair[])
ns0:BalDetailsList(item: ns0:BalDetails[])
ns0:RequestHeader(auditInfo: xsd:string, transactionId: xsd:string)
xsd:string
绑定:
Soap11Binding: {http://www.bbbb.com/PM/BLS}BLS
服务:BLS
Port: BLS (Soap11Binding: {http://www.bbbb.com/PM/BLS}BLS)
Operations:
getBalReq(header: ns0:RequestHeader, custId: xsd:string, customAvpList: ns0:AttributeValuePairList) -> nalId: xsd:string, custId: xsd:string, custRole: xsd:string, nalType: xsd:string, bal: ns0:BalDetailsList, customAvpList: ns0:AttributeValuePairList
只需关注:
from zeep import Client
client = Client('XXXXXXXX.wsdl')
client.service.getBalReq(custId='12345678')
我收到以下错误:
"Missing element %s" % (self.name), path=render_path
zeep.exceptions.ValidationError: Missing element header (GetBalReq.header)
最近 2 天我一直在绞尽脑汁如何使这项工作正常进行,如何发送正确的请求以获得有效响应,阅读 zeep 文档、论坛等,但就是想不通。知道正确的代码吗?
您必须将参数 'header' 传递给方法 'getBalReq',如下所示。
from zeep import Client
client = Client('XXXXXXXX.wsdl')
header_request = client.get_type('ns0:RequestHeader')
header = header_request(auditInfo = your_auditInfo,transactionId = your_transactionId)
client.service.getBalReq(header=header, custId='12345678', customAvpList = your_customAvpList)
如果customAvpList是可选参数,可以忽略。