Skip to content

WS-Addressing: wrong wsa action #777

Open
@aam2020

Description

@aam2020
  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.
wsa:Actionhttp://www.tourlineexpress.com/IService1/GetEtiquetaTxtPT</wsa:Action>

It should be:
wsa:Actionhttp://www.tourlineexpress.com/IService1/GetEtiquetaTxt</wsa:Action>

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:
wsa:Actionhttp://www.tourlineexpress.com/IService1/GetEtiquetaTxt</wsa:Action>

Thanks in advance,
aam

Metadata

Metadata

Assignees

No one assigned

    Labels

    requires/example-scriptPlease provide a standalone script which reproduces your problem

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions