Closed mattpepin closed 8 years ago
The capitalized SOAP-ENV shouldn't be a problem. It it just a shorthand for the long namespace (via xmlns:
Do you have a traceback for me?
Sure!
Traceback (most recent call last):
File "onvif-test.py", line 54, in <module>
print(o.devicemgmt.GetDeviceInformation())
File "test/lib/python3.5/site-packages/zeep/client.py", line 24, in __call__
self._op_name, args, kwargs)
File "test/lib/python3.5/site-packages/zeep/wsdl/soap.py", line 94, in send
return self.process_reply(client, operation_obj, response)
File "test/lib/python3.5/site-packages/zeep/wsdl/soap.py", line 125, in process_reply
return operation.process_reply(doc)
File "test/lib/python3.5/site-packages/zeep/wsdl/soap.py", line 249, in process_reply
return self.output.deserialize(node)
File "test/lib/python3.5/site-packages/zeep/wsdl/messages.py", line 237, in deserialize
elm = node.find(part.element.qname)
AttributeError: 'NoneType' object has no attribute 'find'
Can you add the following in SoapOperation.process_reply()
:
assert node is not None, "No {%s}:Body found" % (self.nsmap['soap-env'])
That is after: node = envelope.find('soap-env:Body', namespaces=self.nsmap)
AssertionError: No {http://www.w3.org/2003/05/soap-envelope}:Body found
Ah, it looks like the camera is using the wrong namespace: http://schemas.xmlsoap.org/soap/envelope instead of http://www.w3.org/2003/05/soap-envelope Not sure what that implies...
Hm it seems 'http://www.w3.org/2003/05/soap-envelope' is for soap 1.2. Which means it's a bug in zeep :-)
Let me know if it isn't fixed. Thanks for reporting
Hum nope! I still get:
AssertionError: No {http://www.w3.org/2003/05/soap-envelope}Body found
Ah okay, so I didn't read your reply correctly. It seems that soap 1.2 is used but the response returns a namespace for soap 1.1. I'll need to check this later
Thanks!
Looked at it a bit better now:
The issue is that the request is done via the Soap1.2 binding (and that is the only binding in the wsdl) and the response is a Soap 1.1 response. This seems to be a bug on the server. There is some documentation about handling version mismatches (https://www.w3.org/TR/soap12-part1/#version) but that doesn't seem to apply here.
You can work around this issue by subclassing the transport class and altering the response in the post() method there (a really naive example: content = content.replace(<soap 1.1 namespace>, <soap 1.2 namespace>
) .
Here's the reply from a cheap ONVIF camera to a request. Note the capitalized SOAP-ENV.
It makes python-zeep crash since 'soap-env:Body' is not found. Zeep works fine for better cameras with proper soap-env:Body. There should be a way to handle stupid devices like this one...