Odoo Help


Web Services Tutorial Odoo/PHP

Thierry Godin
on 7/30/14, 4:16 PM 19,175 views

Hello all,

I just published a new tutorial about Web Services.

For now, it's only in french. US translation 's coming soon.


@Thierry, what would be the best way to work from Android to Odoo? Could you then best direct from Android to mySQL / PHP and then too Odoo? Or would there be a way to send from Android to Odoo instantly? Thanks for the tutorial, its great.

on 10/29/14, 6:34 AM

@Yenthe , Sorry mate, I don't know Android programming. I cannot help you for this :(

Thierry Godin
on 10/29/14, 4:03 PM

Thierry Godin

--Thierry Godin--
| 8 7 8
Collegien, France
--Thierry Godin--


Thierry Godin
On 9/17/14, 3:57 PM

The english version of the tutorial is here :


The files of the scripts can be downloaded here :


Good job Thierry. I wait the tutorial on odoo interface customization.

ThackerS (ts)
on 9/17/14, 4:04 PM

Thank you for sharing this Thierry! This is a goldmine of basic information to learn from.

on 10/13/14, 9:51 AM

Thnaks Thierry Godin ...

Ashish Singh
on 10/14/14, 2:26 AM
On 10/13/14, 9:43 AM

Hi Godin,

I'm new to odoo and have just successfully installed odoo under Ubuntu in Oracle Virtual Box (virtual machine), which is running under windows 8. Luckily, everything is fine by using the application. 

Your tutorial is great, thanks a lot. I followed your example code (copied below) to practice. Unfortunately, the PHP program stopped at this statement "$connexion = new xmlrpc_client($server_url . "/xmlrpc/common");". And there were no error messages shown at all. 

Can you provide further help?

1. Are there any error messages to trace what happen?

2. Are there any system settings in odoo before I can use PHP XML-RPC?

Thanks a lot for your help in advance.



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


$user = 'admin';
$password = 'mY5up3rPwd';
$dbname = 'test';

$server_url = ''; 
$connexion = new xmlrpc_client($server_url . "/xmlrpc/common");

$c_msg = new xmlrpcmsg('login');
$c_msg->addParam(new xmlrpcval($dbname, "string"));
$c_msg->addParam(new xmlrpcval($user, "string"));
$c_msg->addParam(new xmlrpcval($password, "string"));
$c_response = $connexion->send($c_msg);

if ($c_response->errno != 0){
    echo  '<p>error : ' . $c_response->faultString() . '</p>';
    $uid = $c_response->value()->scalarval();

    $val = array ( 
        "name"    => new xmlrpcval("Godin Thierry", "string"),
        "street"  => new xmlrpcval("Au fond à gauche", "string"),
        "city"    => new xmlrpcval("Marne la Vallée", "string"),
        "zip"     => new xmlrpcval("77000", "string"),
        "website" => new xmlrpcval("http://www.lapinmoutardepommedauphine.com", "string"),
        "lang"    => new xmlrpcval("fr_FR", "string"),
        "tz"      => new xmlrpcval("Europe/Paris", "string"),
    $client = new xmlrpc_client($server_url . "/xmlrpc/object");

    $msg = new xmlrpcmsg('execute'); 
    $msg->addParam(new xmlrpcval($dbname, "string")); 
    $msg->addParam(new xmlrpcval($uid, "int")); 
    $msg->addParam(new xmlrpcval($password, "string")); 
    $msg->addParam(new xmlrpcval("res.partner", "string")); 
    $msg->addParam(new xmlrpcval("create", "string")); 
    $msg->addParam(new xmlrpcval($val, "struct")); 
    $response = $client->send($msg);
    echo 'Partner created - partner_id = ' . $response->value()->scalarval();

Hi Charles, You have to set the proper IP address of your own server, you have to set the proper dbname you use and your own credentials (username + password). Also, ensure you have copied the xmlrpc lib in the right path.

Thierry Godin
on 10/13/14, 10:32 AM

Hi Thierry, Thank you very much for your reply. I'm sorry that I didn't make it clear. I did set the IP address, dbname, login and password correctly. For the xmlrpc lib, I copy it to a folder by following your comments in your tutorial. Please my code extract below. By the way, my odoo version is 8. Are there any settings in the odoo server side? echo '


'; include("xmlrpc/lib/xmlrpc.inc.php"); include("xmlrpc/lib/xmlrpcs.inc.php"); $GLOBALS['xmlrpc_internalencoding']='UTF-8'; $user = 'admin'; $password = 'password'; $dbname = 'mydb'; $server_url = '';
on 10/14/14, 9:05 AM

Hi Thierry, I've found a problem. In my version of xmlrpc, the file names of xmlrpc.inc and xmlrpcs.inc are without .php. In other words, the file names are xmlrpc.inc and xmlrpcs.inc only. In addition, there is typo in the program. It should be $c_response (not $response) of the following statement : echo 'Partner created - partner_id = ' . $response->value()->scalarval(); Although the program can be run successfully now, I can't find the record in odoo. Will check again tomorrow. Good night.

on 10/15/14, 11:21 AM

Your 're right Charles, right typo is $c_response. Thanks for the info. About adding .php to .inc file is a security stuff to avoid diplaying inc file in browser.

Thierry Godin
on 10/15/14, 2:15 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

7 follower(s)


Asked: 7/30/14, 4:16 PM
Seen: 19175 times
Last updated: 4/27/17, 4:36 PM