Search code examples
pythonsoapsuds

Accessing response soap header using suds


I have a soap 1.1/1.2 web service I'm trying to access using suds.

Unfortunately the service puts authentication token in response soap header.

Is it possible to access the header somehow?

I know one can set a custom soap header in the request, but that's not what I'm looking for.


Solution

  • You can do something like

    print client.last_received().getChild("soap:Envelope").getChild("soap:Header")
    .getChild("ResponseHeader").getChild("resultCode").getText()
    

    The above reads a field resultCode in the soap header. You have to do this for each field. This was a back door left to read headers as much as i know.

    For details look at soap headers with suds