From 104d92fc323d619116876d648195ebf93f0a82c6 Mon Sep 17 00:00:00 2001 From: jortel Date: Wed, 5 May 2010 22:08:03 +0000 Subject: Search successful reply envelopes for to detect cases when servers return http=200 but envelope contians a fault. --- suds/__init__.py | 2 +- suds/bindings/binding.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1