mvantellingen / python-zeep

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

Response is always 202 Except for login API #1324

Open RakeshSharma04 opened 1 year ago

RakeshSharma04 commented 1 year ago

Hi,

The constructed xml after adding header always give status code 202

The expected xml is

<?xml version="1.0" encoding="UTF-8" ?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> <h:ContractVersion xmlns:h="http://schemas.test.com/WebServices">0 </h:ContractVersion> <h:EnableExceptionStackTrace xmlns:h="http://schemas.test.com/WebServices">false </h:EnableExceptionStackTrace> <h:MessageContractVersion i:nil="true" xmlns:h="http://schemas.test.com/WebServices" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" /> <h:Signature xmlns:h="http://schemas.test.com/WebServices">ZsRDVUlo2nI=|XRCwPaaG4S8TlGvRCxBX9QYW18Muyh3sP1gHoj+IHe5SNcsr6cV/CGrWSTX1xqz8LOsW3D5wMPZ4t6mPGBecUOK+ZqhlTCqIk3lYFK9Kewr6QzOwkA90GuJ34mvCO83gZ+Fk+UcGG9k= </h:Signature> </s:Header> <s:Body> <LogoutRequest xmlns="http://schemas.test.com/WebServices/ServiceContracts/SessionService" /> </s:Body> </s:Envelope>

Following is the xml constructed after adding the header

`<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

https://6etestr4xapi.test.com/Logout https://6etestr4xapi.test.com/SessionManager.svc vINTd4zRrqc=|Sl7IkpH1WmPHbaRGBh65YHyavsGcpp3GuOyBX8mpOx9KHKk1C5En1ItoYCMeqUc44QvaVsIxDosUNQcxQ25GLQZi0hU2AqeEm/VEILWP0vvihY5q3Bgr79L8tQLmPT8mH5TERxFumdg=
    <wsa:Action>http://schemas.test.com/WebServices/ISessionManager/Logout</wsa:Action>
    <wsa:MessageID>urn:uuid:85edb9f6-2500-443d-942b-8bdbe414ff0d</wsa:MessageID>
    <wsa:To>https://6etestr4xapi.test.com/SessionManager.svc</wsa:To>
</soap-env:Header>
<soap-env:Body>
    <ns0:LogoutRequest
        xmlns:ns0="http://schemas.test.com/WebServices/ServiceContracts/SessionService"/>
    </soap-env:Body>
</soap-env:Envelope>`

Header

`header_logOut = zeep.xsd.Element( "Header", zeep.xsd.ComplexType( [ zeep.xsd.Element( "{http://www.w3.org/2005/08/addressing}Action", zeep.xsd.String() ), zeep.xsd.Element( "{http://www.w3.org/2005/08/addressing}To", zeep.xsd.String() ), zeep.xsd.Element( "{http://schemas.test.com/WebServices}Signautre", zeep.xsd.String() ), ] ), )

set the header value from header element

header_value = header(Action=login_test, To=service_url)`

with client.settings(raw_response=True): result1 = client.service.Logout( _soapheaders= [header_value_logout] )

The response is always 202

RakeshSharma04 commented 1 year ago

When printing the response content it is empty

print(result1.content)

prints b''