From e956d83aa29c64ba849f8bc9f071f544f1ec83da Mon Sep 17 00:00:00 2001 From: Mariano Reingart Date: Sun, 19 Jan 2014 18:27:56 -0300 Subject: [PATCH] fixed issue 153: correct 500 status if there is a SOAP fault --- gluon/tools.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gluon/tools.py b/gluon/tools.py index 4d30f83d..fdbd3bb0 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -4830,9 +4830,15 @@ class Service(object): for method, (function, returns, args, doc) in procedures.iteritems(): dispatcher.register_function(method, function, returns, args, doc) if request.env.request_method == 'POST': + fault = {} # Process normal Soap Operation response.headers['Content-Type'] = 'text/xml' - return dispatcher.dispatch(request.body.read()) + xml = dispatcher.dispatch(request.body.read(), fault=fault) + if fault: + # May want to consider populating a ticket here... + response.status = 500 + # return the soap response + return xml elif 'WSDL' in request.vars: # Return Web Service Description response.headers['Content-Type'] = 'text/xml'