我对Zeep的SOAP请求有疑问。
首先,我需要将“ PasswordDigest”更改为“ PasswordText”,但其他的必须稳定。
当我将wsdl端点更改为此时;在SOAP请求中突然出现“ http://10.1.3.17:9090/EGMENDPOINT/EGMTest/Router.svc/BankalarToEGMRehin”,WSA:部分更改为“ http://10.1.3.17:9090/EGMENDPOINT/EGMTest/Router.svc/BankalarToEGMRehin”。
wsa:要分开的部分必须为“ https://egmtest.egm.gov.tr/EGMTest/Router.svc/BankalarToEGMRehin”,但我的请求必须为“ http://10.1.3.17:9090/EGMENDPOINT/EGMTest/Router.svc/BankalarToEGMRehin”。
我在SOAPUI上尝试了此操作,并成功了。
这是我的代码块;
client = zeep.Client(wsdl=wsdl + "/egm_test.wsdl", plugins=[history], wsse=UsernameToken(username=username,password=password, use_digest=True))
inputDict = {
"AsbisTescilReferansNumarasi" : asbisTescilRefNo,
"KurumKodu" : kurumKodu,
"Plaka" : plaka,
"TescilBelgeSeriNo" : tescilBelgeSeriNo,
"UserId" : userId
}
service = client.create_service(binding_name=binding_name, address='http://10.1.3.17:9090/EGMENDPOINT/EGMTest/Router.svc/BankalarToEGMRehin')
service.PlakaDanAracBul(inputDict)
我期望如下所示的请求;
<soap:Envelope xmlns:egm="http://schemas.datacontract.org/2004/07/EGM.ASBIS.Servisler.BankaServisleri" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-6B36D701BAFB065CBC15627557818394">
<wsse:Username>*****</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">*****</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">BSDn9OHoxi38xbTAJ4Nwvg==</wsse:Nonce>
<wsu:Created>2019-07-10T10:49:41.839Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
<wsa:Action soap:mustUnderstand="1">http://tempuri.org/IAsbisBankaServis/PlakaDanAracBul</wsa:Action>
<wsa:To soap:mustUnderstand="1">https://egmtest.egm.gov.tr/EGMTest/Router.svc/BankalarToEGMRehin</wsa:To>
</soap:Header>
<soap:Body>
<tem:PlakaDanAracBul>
<!--Optional:-->
<tem:pPlakaDanAracBulRequest>
<egm:AsbisTescilReferansNumarasi>0</egm:AsbisTescilReferansNumarasi>
<egm:KurumKodu>131</egm:KurumKodu>
<egm:Plaka>06BG0952</egm:Plaka>
<egm:TescilBelgeSerino>AI631776</egm:TescilBelgeSerino>
<egm:UserId>*****</egm:UserId>
</tem:pPlakaDanAracBulRequest>
</tem:PlakaDanAracBul>
</soap:Body>
</soap:Envelope>
但是实际输出是;
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>http://tempuri.org/IAsbisBankaServis/PlakaDanAracBul</wsa:Action>
<wsa:MessageID>urn:uuid:eef6770b-644b-4340-9da0-e269fff2df7a</wsa:MessageID>
<wsa:To>https://egmtest.egm.gov.tr/EGMTest/Router.svc/BankalarToEGMRehin</wsa:To>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>*****</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">*****</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MnVBgY35+7YgTIMPUiavZQ==</wsse:Nonce>
<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2019-07-10T10:43:26+00:00</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body>
<ns0:PlakaDanAracBul xmlns:ns0="http://tempuri.org/">
<ns0:pPlakaDanAracBulRequest>
<ns1:AsbisTescilReferansNumarasi xmlns:ns1="http://schemas.datacontract.org/2004/07/EGM.ASBIS.Servisler.BankaServisleri"></ns1:AsbisTescilReferansNumarasi>
<ns2:KurumKodu xmlns:ns2="http://schemas.datacontract.org/2004/07/EGM.ASBIS.Servisler.BankaServisleri">0108</ns2:KurumKodu>
<ns3:Plaka xmlns:ns3="http://schemas.datacontract.org/2004/07/EGM.ASBIS.Servisler.BankaServisleri"></ns3:Plaka>
<ns4:TescilBelgeSerino xmlns:ns4="http://schemas.datacontract.org/2004/07/EGM.ASBIS.Servisler.BankaServisleri" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ns5:UserId xmlns:ns5="http://schemas.datacontract.org/2004/07/EGM.ASBIS.Servisler.BankaServisleri">******</ns5:UserId>
</ns0:pPlakaDanAracBulRequest>
</ns0:PlakaDanAracBul>
</soap-env:Body>
</soap-env:Envelope>