xmlrpc errors not following standard

Bug #1023429 reported by Marcos Mendez

This bug report was converted into a question: question #202983: xmlrpc errors not following standard.

10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

When creating a partner with no fields, the xmlrpc response is below. not that the fault code should be a number as per spec. the fault string is empty.

<methodResponse>
 <fault>
  <value>
   <struct>
    <member>
     <name>faultCode</name>
     <value>
      <string>warning -- Integrity Error
       The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it
       - creation/update: a mandatory field is not correctly set [object with reference: name - name]</string>
     </value>
    </member>
    <member>
     <name>faultString</name>
     <value>
      <string />
     </value>
    </member>
   </struct>
  </value>
 </fault>
</methodResponse>

Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello Marcos Mendez,

I tried as your given code with script its giving me a traceback but I did
not get found <name> fault Code </name> and as per
trackback it comes from python xmlrpclib.py.

Traceback (most recent call last):
  File "test.py", line 36, in <module>
    sock.execute(dbname, uid, pwd, 'res.partner', 'create', meet)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault warning -- Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set.

[object with reference: name - name]: ''>

So would you please provide detail info regarding this issue.

Thank You!

Changed in openobject-server:
status: New → Incomplete
Revision history for this message
Marcos Mendez (marcos-hr7) wrote :

if you use the attached file you will get the following error:

Traceback (most recent call last):
  File "create_partner_nofields.py", line 15, in <module>
    sock = xmlrpclib.ServerProxy('%s/xmlrpc/common'%host)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1541, in __init__
    raise IOError, "unsupported XML-RPC protocol"
IOError: unsupported XML-RPC protocol

if you put a proxy in the middle, you will notice that the returned xml exception is not in the correct format.

Changed in openobject-server:
status: Incomplete → Invalid
Revision history for this message
Marcos Mendez (marcos-hr7) wrote :

For some reason this was marked a question or invalid.

Again, to restart. The XMLRPC spec (http://xmlrpc.scripting.com/spec.html) defines a fault code as:

"The <methodResponse> could also contain a <fault> which contains a <value> which is a <struct> containing two elements, one named <faultCode>, an <int> and one named <faultString>, a <string>. A <methodResponse> can not contain both a <fault> and a <params>."

OpenERP does not adhere to this by returning things like:

<methodResponse>
 <fault>
  <value>
   <struct>
    <member>
     <name>faultCode</name>
     <value>
      <string>'res.users' object has no attribute 'READ'</string>
     </value>
    </member>
    <member>
     <name>faultString</name>
     <value>
      <string>Traceback (most recent call last):
       File "/usr/lib/pymodules/python2.7/openerp/wsgi/core.py", line 79, in xmlrpc_return result = openerp.netsvc.dispatch_rpc(service, method, params)
       File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 360, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params)
       File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 572, in dispatch res = fn(db, uid, *params)
       File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 121, in wrapper return f(self, dbname, *args, **kwargs)
       File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw)
       File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 164, in execute_cr return getattr(object, method)(cr, uid, *args, **kw)
       AttributeError: 'res.users' object has no attribute 'READ' </string>
     </value>
    </member>
   </struct>
  </value>
 </fault>
</methodResponse>

Changed in openobject-server:
status: Invalid → New
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hi Marcos,

This is a duplicate of very old bug 257581. As the bug status indicates, it was fixed as of OpenERP 6.1, but you may not have noticed it because the old XML-RPC API is still present for backwards compatibility.

The old API (v0) was routed through /xmlrpc, whereas the new XML-RPC API (v1) is available at /openerp/xmlrpc/1. You will get standard XML-RPC faults if you use the new one. For more information see tests/common.py or openerp/wsgi/core.py in the 6.1 server code.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.