Skip to content

Commit 377d931

Browse files
holstebroemvantellingen
authored andcommitted
Fix to deserializer if result type does not have a length
An exception will be thrown if a bool is returned from a SOAP service call. `deserialize` soap.py will ask for the length of the result body, but it may not be allowed to take len on some result body types. Added check if length is valid and returns the body directly if it is not. I haven't tested with any other types, such as integers.
1 parent d0d737a commit 377d931

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/zeep/wsdl/messages/soap.py

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def deserialize(self, envelope):
116116
return result
117117

118118
result = result.body
119+
if not hasattr(result, '__len__'): # Return body directly if len is allowed (could indicated valid primitive type).
120+
return result
119121
if result is None or len(result) == 0:
120122
return None
121123
elif len(result) > 1:

0 commit comments

Comments
 (0)