You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to test an API which I don't have access to yet. So I went to mockable.io and pasted a sample response I got from the API provider. Here is my mockable configuration:
>>> import pretend
>>> from zeep import Client
>>> from zeep.transports import Transport
>>> client = Client('http://demo6341126.mockable.io/?wsdl')
>>> response = pretend.stub(
... status_code=200,
... headers={},
... content=b"""<?xml version="1.0" encoding="utf-8"?>
... <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
... <soap:Body>
... <TestResponse xmlns="http://tempuri.org/">
... <TestResult>
... <Test>
... <field>string</field>
... <status>string</status>
... </Test>
... <Test>
... <field>string</field>
... <status>string</status>
... </Test>
... </TestResult>
... </TestResponse>
... </soap:Body>
... </soap:Envelope>""")
>>> operation = client.service._binding._operations['MyTestAction']
>>> result = client.service._binding.process_reply(
... client, operation, response)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/renyhp/testzeep/venv/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 231, in process_reply
result = operation.process_reply(doc)
File "/home/renyhp/testzeep/venv/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 430, in process_reply
return self.output.deserialize(envelope)
File "/home/renyhp/testzeep/venv/lib/python3.8/site-packages/zeep/wsdl/messages/soap.py", line 122, in deserialize
result = next(iter(result.__values__.values()))
AttributeError: 'list' object has no attribute '__values__'
If the response contains multiple TestResults with one Test each, zeep throws no error. But it goes without saying that I have no control over the API responses.
I'm running zeep v4.0.0.
The text was updated successfully, but these errors were encountered:
diff --git a/src/zeep/wsdl/messages/soap.py b/src/zeep/wsdl/messages/soap.py
index 553bfa2..cda0cdb 100644
--- a/src/zeep/wsdl/messages/soap.py
+++ b/src/zeep/wsdl/messages/soap.py
@@ -119,6 +119,8 @@ class SoapMessage(ConcreteMessage):
# Check if we can remove the wrapping object to make the return value
# easier to use.
+ if not hasattr(result,'__values__'):
+ return result
result = next(iter(result.__values__.values()))
if isinstance(result, xsd.CompoundValue):
children = result._xsd_type.elements
I'm trying to test an API which I don't have access to yet. So I went to mockable.io and pasted a sample response I got from the API provider. Here is my mockable configuration:
![immagine](https://user-images.githubusercontent.com/20142663/96773656-238fd780-13e5-11eb-80a1-983e177dd1e9.png)
Here is the WDSL generated by mockable.
Python code:
If the response contains multiple TestResults with one Test each, zeep throws no error. But it goes without saying that I have no control over the API responses.
I'm running zeep v4.0.0.
The text was updated successfully, but these errors were encountered: