Posted By

JustGreg on 07/29/09


Tagged

xml-rpc OpenERP


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


OpenERP: XML-RPC Web services (Example)


 / Published in: PHP
 

URL: http://doc.openerp.com/developer/6_22_XML-RPC_web_services/

Here is an example on how to insert a new partner using PHP. This example makes use the phpxmlrpc library, available on sourceforge.

  1. <?
  2.  
  3. include('xmlrpc.inc');
  4.  
  5. $arrayVal = array(
  6. 'name'=>new xmlrpcval('Fabien Pinckaers', "string") ,
  7. 'vat'=>new xmlrpcval('BE477472701' , "string")
  8. );
  9.  
  10. $client = new xmlrpc_client("http://localhost:8069/xmlrpc/object");
  11.  
  12. $msg = new xmlrpcmsg('execute');
  13. $msg->addParam(new xmlrpcval("dbname", "string"));
  14. $msg->addParam(new xmlrpcval("3", "int"));
  15. $msg->addParam(new xmlrpcval("demo", "string"));
  16. $msg->addParam(new xmlrpcval("res.partner", "string"));
  17. $msg->addParam(new xmlrpcval("create", "string"));
  18. $msg->addParam(new xmlrpcval($arrayVal, "struct"));
  19.  
  20. $resp = $client->send($msg);
  21.  
  22. if ($resp->faultCode())
  23.  
  24. echo 'Error: '.$resp->faultString();
  25.  
  26. else
  27.  
  28. echo 'Partner '.$resp->value()->scalarval().' created !';
  29.  
  30. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: JustGreg on July 29, 2009

Access Open-server using xml-rpc

Download the XML-RPC framework for PHP windows / linux: download the xml-rpc framework for php from http://phpxmlrpc.sourceforge.net/ The latest stable release is version 2.2 released on February 25, 2007

Setup the XML-RPC for PHP extract file xmlrpc-2.2.tar.gz and take the file xmlrpc.inc from lib directory place the xmlrpc.inc in the php library folder restart the apcahe/iis server

You need to login to post a comment.