Tuesday, 21 May 2019

Odoo XML-RPC Traceback (most recent call last)

I'm new one on Odoo, and I don't have experience with the system and try to follow the documentation how they do it.

For my first thing what I need is to connect external PHP web application whit our Odoo system.

I see this is possible and I follow the steps on that documentation: Odoo Documentation

So I'm stick here:

$common = ripcord::client("$url/xmlrpc/2/common");
$common->version();

When I execute that lines of code I get that error:

[faultString] => Traceback (most recent call last):
File "/home/odoo/src/odoo/12.0/odoo/addons/base/controllers/rpc.py", line 63, in xmlrpc_2
response = self._xmlrpc(service)
File "/home/odoo/src/odoo/12.0/odoo/addons/base/controllers/rpc.py", line 42, in _xmlrpc
params, method = loads(data)
File "/usr/lib/python3.5/xmlrpc/client.py", line 1000, in loads
p.close()
File "/usr/lib/python3.5/xmlrpc/client.py", line 447, in close
parser.Parse(b"", True) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0

I use demo URL (https://demo.odoo.com/) which their recommend. And from first example I get username, password, database name, successfully. But after that I cannot do anything.

UPDATE: That is my PHP class which I call for testing:

require_once(__DIR__ . '/Ripcode/ripcord.php');

class Ripcode
{
    private $_url = 'https://demo.odoo.com/';

    private $_server = [];

    private $_connection = null;

    private $_common = null;

    public function __construct()
    {
         $this->_server = \ripcord::client($this->_url . 'start')->start();
         $common = \ripcord::client($this->_url . "xmlrpc/2/common");
         $common->version();

         $models = \ripcord::client($this->_url . "xmlrpc/2/object");

         $uid = $common->authenticate(
             $this->_server['database'],
             $this->_server['user'],
             $this->_server['password'],
             array()
         );

         showArray([
            'server' => $this->_server,
            'uid' => $uid
         ]);

         showArray([
            'server' => $this->_server,
            'models' => $models,
            'uid' => $uid
            'common' => $common->version()
         ]);
    }
}



from Odoo XML-RPC Traceback (most recent call last)

No comments:

Post a Comment