Open tseader opened 1 year ago
Experiencing Fault with "Unknown fault occured" message when a 202 status-code returns with content.
Runnable test below when in tests/test_wsdl_soap.py. Derived test from a combination of the following two existing tests:
tests/test_wsdl_soap.py
def test_response_202_with_content(): """Test 202 response with content that passes with patch""" data = """ <?xml version="1.0"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stoc="http://example.com/stockquote.xsd"> <soapenv:Header/> <soapenv:Body> <stoc:TradePrice> <price>120.123</price> </stoc:TradePrice> </soapenv:Body> </soapenv:Envelope> """.strip() response = stub(status_code=202, content=data, encoding="utf-8", headers={}) client = Client("tests/wsdl_files/soap.wsdl") binding = client.service._binding result = binding.process_reply(client, binding.get("GetLastTradePrice"), response) assert result == 120.123
The issue has been traced to line 228 of zeep.wsdl.bindings.soap module, in the process_reply function.
process_reply
From if response.status_code != 200 or fault_node is not None: To: if response.status_code not in (200, 202) or fault_node is not None:
if response.status_code != 200 or fault_node is not None:
if response.status_code not in (200, 202) or fault_node is not None:
Alternatively, could let pass more HTTP status codes in the 2xx range if appropriate (shrug)
Experiencing Fault with "Unknown fault occured" message when a 202 status-code returns with content.
Context
Test to Prove Issue
Runnable test below when in
tests/test_wsdl_soap.py
. Derived test from a combination of the following two existing tests:Issue Source Identified
The issue has been traced to line 228 of zeep.wsdl.bindings.soap module, in the
process_reply
function.Suggested change:
From
if response.status_code != 200 or fault_node is not None:
To:if response.status_code not in (200, 202) or fault_node is not None:
Alternatively, could let pass more HTTP status codes in the 2xx range if appropriate (shrug)