summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjortel <devnull@localhost>2010-05-05 22:08:03 +0000
committerjortel <devnull@localhost>2010-05-05 22:08:03 +0000
commit104d92fc323d619116876d648195ebf93f0a82c6 (patch)
tree5eff9a6f19711cfb60699e57d1399024fef9b206
parent3e34e48598eba306261b4401e4735d18c1eec673 (diff)
downloadsuds-104d92fc323d619116876d648195ebf93f0a82c6.tar.gz
Search successful reply envelopes for <soapenv:Fault/> to detect cases when servers return http=200 but envelope contians a fault.
-rw-r--r--suds/__init__.py2
-rw-r--r--suds/bindings/binding.py18
2 files changed, 19 insertions, 1 deletions
diff --git a/suds/__init__.py b/suds/__init__.py
index b403d43..12eed79 100644
--- a/suds/__init__.py
+++ b/suds/__init__.py
@@ -27,7 +27,7 @@ import sys
#
__version__ = '0.4'
-__build__="(beta) R674-20100503"
+__build__="(beta) R675-20100505"
#
# Exceptions
diff --git a/suds/bindings/binding.py b/suds/bindings/binding.py
index 959c339..ef857df 100644
--- a/suds/bindings/binding.py
+++ b/suds/bindings/binding.py
@@ -145,6 +145,7 @@ class Binding:
soapenv = replyroot.getChild('Envelope')
soapenv.promotePrefixes()
soapbody = soapenv.getChild('Body')
+ self.detect_fault(soapbody)
soapbody = self.multiref.process(soapbody)
nodes = self.replycontent(method, soapbody)
rtypes = self.returned_types(method)
@@ -162,6 +163,23 @@ class Binding:
return (replyroot, result)
return (replyroot, None)
+ def detect_fault(self, body):
+ """
+ Detect I{hidden} soapenv:Fault element in the soap body.
+ @param body: The soap envelope body.
+ @type body: L{Element}
+ @raise WebFault: When found.
+ """
+ fault = body.getChild('Fault', envns)
+ if fault is None:
+ return
+ unmarshaller = self.unmarshaller(False)
+ p = unmarshaller.process(fault)
+ if self.options().faults:
+ raise WebFault(p, fault)
+ return self
+
+
def replylist(self, rt, nodes):
"""
Construct a I{list} reply. This mehod is called when it has been detected