Hello. Currently, XMLRPCServlet catches any exception in a service
method and wraps it in a Fault object with faultCode forced to 1.
This seems... wrong. The whole point of having fault codes is that
you can flag error conditions to the caller in an easy-to-parse way.
I suggest something like the following be applied to XMLRPCServlet.py;
it allows your service method to raise a Fault directly, in which case
it's marshalled back unmolested.
[diff begins]
diff -d -c -r1.3 XMLRPCServlet.py
*** XMLRPCServlet.py 3 Mar 2003 03:27:53 -0000 1.3
--- XMLRPCServlet.py 11 Jan 2004 02:24:19 -0000
***************
*** 44,49 ****
--- 44,53 ----
response = self.call(method, *params)
if type(response) != type(()):
response = (response,)
+ except xmlrpclib.Fault, fault:
+ response = xmlrpclib.dumps(fault, encoding=encoding)
+ self.sendOK('text/xml', response, transaction)
+ self.handleException(transaction)
except Exception, e:
fault = self.resultForException(e, transaction)
response = xmlrpclib.dumps(xmlrpclib.Fault(1, fault), encoding=encoding)
[diff ends]
~
|