mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.88k stars 585 forks source link

WS-Addressing: wrong wsa action #777

Open aam2020 opened 6 years ago

aam2020 commented 6 years ago
  1. The version of zeep: 3.0.0
  2. The WSDL you are using https://gist.github.com/aam2020/b8ce943413c6a7f8bbbf8614b0aa6b1d
  3. And most importantly, a [runnable example script]:
from lxml import etree
from zeep import Client

client = Client('https://gist.githubusercontent.com/aam2020/b8ce943413c6a7f8bbbf8614b0aa6b1d/raw/54c5c99c6f8c954d4692846fa9c3fc6386942e88/Service1.svc.wsdl')
wsuser = 'xxxx'
wspass = 'xxxx'
soapheaders = dict(UserId=wsuser, Password=wspass)
request_dict = {'AgencyClientCode':'xx', 'ClientCode':'xx/xx',
        'ShipmentCode': 'xxx',
            'ShipmentLabelType': 'Z'}

node = client.create_message(
    client.service, 'GetEtiquetaTxt', _soapheaders=soapheaders, **request_dict)

print(etree.tostring(node, pretty_print=True))

Hello.

The above script returns a message with the wsa:Action tag incorrect, and produces an error by the server that the SOAP action and the HTTP action mismatch.

http://www.tourlineexpress.com/IService1/GetEtiquetaTxtPT It should be: http://www.tourlineexpress.com/IService1/GetEtiquetaTxt If I change the WsAddressingPlugin in the wsa.py file, and instead of: def egress(self, envelope, http_headers, operation, binding_options): """Apply the ws-addressing headers to the given envelope.""" wsa_action = operation.input.abstract.wsa_action if not wsa_action: wsa_action = operation.soapaction change it to: def egress(self, envelope, http_headers, operation, binding_options): """Apply the ws-addressing headers to the given envelope.""" wsa_action = operation.soapaction it gets the correct tag: http://www.tourlineexpress.com/IService1/GetEtiquetaTxt Thanks in advance, aam
mvantellingen commented 6 years ago

I cannot run your script due to connection issues to ws.tourlineexpress.com. Perhaps it's firewalled?