我正在与DHL WSdL斗争。商业soap-api和python zeep。需要通过soap-header进行身份验证 假设正确的请求看起来像这样 $ SAMEUSER是相同的密码:)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cis="http://dhl.de/webservice/cisbase" xmlns:bus="http://dhl.de/webservices/businesscustomershipping">
<soapenv:Header>
<cis:Authentification>
<cis:user>${SAMEUSER}</cis:user>
<cis:signature>pass</cis:signature>
</cis:Authentification>
</soapenv:Header>
<soapenv:Body>
<bus:CreateShipmentOrderRequest>
<bus:Version>
<majorRelease>2</majorRelease>
<minorRelease>2</minorRelease>
</bus:Version>
<ShipmentOrder>
<sequenceNumber>123456</sequenceNumber>
<Shipment>
我的请求看起来像是通过wsdl定义中的zeep数据发现创建的。通过client.service('createShipmentOrder',_soapheaders = [obj_authentification])通过其他内容发送...
print(service.createShipmentOrder(
Version=obj_version,
ShipmentOrder=obj_shipmentorder,
_soapheaders=[
obj_authentification,
],
))
生成的xml是,无法验证其Web服务。
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<ns0:user xmlns:ns0="http://dhl.de/webservice/cisbase">$[SOMEUSER}</ns0:user>
<ns1:signature xmlns:ns1="http://dhl.de/webservice/cisbase">pass</ns1:signature>
</soap-env:Header>
<soap-env:Body>
<ns0:CreateShipmentOrderRequest xmlns:ns0="http://dhl.de/webservices/businesscustomershipping">
<ns0:Version>
<majorRelease>2</majorRelease>
<minorRelease>2</minorRelease>
</ns0:Version>
<ShipmentOrder>
<sequenceNumber>123456</sequenceNumber>
.
有效的请求在其“信封”
中有cis:base定义<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cis="http://dhl.de/webservice/cisbase" [...]
而我的请求在元素本身中定义了那些xmlns。 像
<ns0:user xmlns:ns0="http://dhl.de/webservice/cisbase">$[SOMEUSER}</ns0:user>
我的方式不正确吗?是否可以再次为每个元素定义“cis”?另外为什么它使用ns0用户和ns1用于签名,因为它应该是wsdl-definition的顺式?
我希望这篇文章不太复杂。我有点迷失在这里,如果我自己的要求会如上所述。 定义可以在此链接中找到
https://cig.dhl.de/cig-wsdls/com/dpdhl/wsdl/geschaeftskundenversand-api/2.2/ https://cig.dhl.de/cig-wsdls/com/dpdhl/wsdl/geschaeftskundenversand-api/2.2/geschaeftskundenversand-api-2.2.zip
中的肥皂服务和方法/类型