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.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
echo '
XML-RPC AVEC OPENERP/ODOO ET PHP
';include("xmlrpc_lib/xmlrpc.inc.php");
include("xmlrpc_lib/xmlrpcs.inc.php");
$GLOBALS['xmlrpc_internalencoding']='UTF-8';
$user = 'admin';
$password = 'mY5up3rPwd';
$dbname = 'test';
$server_url = 'http://192.168.1.120:8069';
$connexion = new xmlrpc_client($server_url . "/xmlrpc/common");
$connexion->setSSLVerifyPeer(0);
$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 '
error : ' . $c_response->faultString() . '
';}
else{
$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");
$client->setSSLVerifyPeer(0);
$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();
}
?>