Thursday, June 03, 2010

Open ERP xmlrpc protocol is not respected

I am working on a small lib to ease Java applications integration with Open ERP.

It works but... in case of error there is no clean error handling and the Apache xmlrpc lib fires an exception. The problem being it cannot cast a String into an int.

Well it appears that Open ERP does not follow the xmlrpc protocol...



https://bugs.launchpad.net/openerp/+bug/257581

The 'worst' is there

http://launchpadlibrarian.net/31048347/xmlrpc.patch

which gives the following


=== modified file 'bin/netsvc.py'
--- bin/netsvc.py 2009-08-28 16:50:27 +0000
+++ bin/netsvc.py 2009-08-31 10:11:37 +0000
@@ -262,7 +262,10 @@
             service_name = self.path.split("/")[-1]
             return self.dispatch(service_name, method, params)
         except OpenERPDispatcherException, e:
-            raise xmlrpclib.Fault(tools.exception_to_unicode(e.exception), e.traceback)
+            if 'xmlrpclib' in self.headers.getheader('User-Agent'):
+                raise xmlrpclib.Fault(tools.exception_to_unicode(e.exception), e.traceback)
+            else:
+                raise xmlrpclib.Fault(1,tools.exception_to_unicode(e.exception))
 
 class SSLSocket(object):
     def __init__(self, socket):

So somebody provided a clean fix and nobody cares !

No comments: