Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 什么是xml rpc处理程序?_Php_Xml Rpc_Openerp - Fatal编程技术网

Php 什么是xml rpc处理程序?

Php 什么是xml rpc处理程序?,php,xml-rpc,openerp,Php,Xml Rpc,Openerp,您好,我是开放式ERP的新手,我想使用Write方法更新开放式ERP中的记录。以下更新代码来自上的: /** *$client=xml rpc处理程序 *$relation=关系的名称,例如:res.partner *$attribute=属性的名称ex:code *$operator=搜索词operator ex:ilike,== *$id=要更新的记录的id *$data=要更新的数据 */ 包括(“xmlrpc.inc”); 函数写入($client、$relation、$attribut

您好,我是开放式ERP的新手,我想使用Write方法更新开放式ERP中的记录。以下更新代码来自上的:

/**
*$client=xml rpc处理程序
*$relation=关系的名称,例如:res.partner
*$attribute=属性的名称ex:code
*$operator=搜索词operator ex:ilike,==
*$id=要更新的记录的id
*$data=要更新的数据
*/
包括(“xmlrpc.inc”);
函数写入($client、$relation、$attribute、$operator、$data、$id){
var$user='admin';
var$password='admin';
var$userId=-1;
var$dbname='db_name';
var$server\u url='1http://localhost:8069/xmlrpc/';
$id_val=array();
$id_val[0]=新的xmlrpcval($id,“int”);
if($userIdaddParam(新的xmlrpcval($dbname,“string”));
$msg->addParam(新的xmlrpcval($userId,“int”);
$msg->addParam(新的xmlrpcval($password,“string”);
$msg->addParam(新的xmlrpcval($relation,“string”);
$msg->addParam(新的xmlrpcval(“写入”、“字符串”);
$msg->addParam(新的xmlrpcval($id,“array”);
$msg->addParam(新的xmlrpcval($data,“struct”);
$resp=$client->send($msg);
$val=$resp->value();
$record=$val->scalarval();
返回$record;
}

在上面的代码中,当我调用write函数时,我必须传递$client的第一个参数是xml rpc handler。但我不清楚什么是xml rpc handler。请帮助我。

嗨,最后我得到了解决方案,代码如下:

<?php
include("lib/xmlrpc.inc");

$arrayVal = array(
'name'=>new xmlrpcval('abc', "string") ,
'city'=>new xmlrpcval('xyz' , "string"),
'phone'=>new xmlrpcval('7894500000' , "string")
);

$client = new xmlrpc_client("http://17.23.28.60:8069/xmlrpc/object");
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval("test", "string"));//database name
$msg->addParam(new xmlrpcval("1", "int"));//user id
$msg->addParam(new xmlrpcval("pwd", "string"));//password
$msg->addParam(new xmlrpcval("res.company", "string"));//module name
$msg->addParam(new xmlrpcval("write", "string"));//method name
$msg->addParam(new xmlrpcval("1", "int"));//record id that u want to update
$msg->addParam(new xmlrpcval($arrayVal, "struct"));//fileds to update
$resp = $client->send($msg);
if ($resp->faultCode())

echo 'Error: '.$resp->faultString();

else

echo 'Updated Successfully';

?> 
newxmlrpcval('abc','string'),
'city'=>新的xmlrpcval('xyz','string'),
“电话”=>新的xmlrpcval('7894500000',“字符串”)
);
$client=新的xmlrpc_客户端(“http://17.23.28.60:8069/xmlrpc/object");
$msg=新的xmlrpcmsg('execute');
$msg->addParam(新的xmlrpcval(“测试”、“字符串”)//数据库名称
$msg->addParam(新的xmlrpcval(“1”,“int”)//用户id
$msg->addParam(新的xmlrpcval(“pwd”、“string”)//密码
$msg->addParam(新的xmlrpcval(“res.company”,“string”)//模块名
$msg->addParam(新的xmlrpcval(“写入”、“字符串”)//方法名
$msg->addParam(新的xmlrpcval(“1”,“int”)//要更新的记录id
$msg->addParam(新的xmlrpcval($arrayVal,“struct”)//要更新的文件
$resp=$client->send($msg);
如果($resp->faultCode())
回显“错误:”。$resp->faultString();
其他的
echo“更新成功”;
?> 

如果这是您的代码,您肯定知道,
$client
是什么类别吗?这不是我的代码,而是发布在OpenERP站点()上的示例代码。这就是我不清楚的原因@KumarYou应该更清楚地回答您的问题:“以下是我的更新代码”可能是$sock=newxmlrpc_客户端($server_url.common')$客户=$sock然后。在那一页上的例子有点让人恼火。我已经试过了,但它不起作用。
<?php
include("lib/xmlrpc.inc");

$arrayVal = array(
'name'=>new xmlrpcval('abc', "string") ,
'city'=>new xmlrpcval('xyz' , "string"),
'phone'=>new xmlrpcval('7894500000' , "string")
);

$client = new xmlrpc_client("http://17.23.28.60:8069/xmlrpc/object");
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval("test", "string"));//database name
$msg->addParam(new xmlrpcval("1", "int"));//user id
$msg->addParam(new xmlrpcval("pwd", "string"));//password
$msg->addParam(new xmlrpcval("res.company", "string"));//module name
$msg->addParam(new xmlrpcval("write", "string"));//method name
$msg->addParam(new xmlrpcval("1", "int"));//record id that u want to update
$msg->addParam(new xmlrpcval($arrayVal, "struct"));//fileds to update
$resp = $client->send($msg);
if ($resp->faultCode())

echo 'Error: '.$resp->faultString();

else

echo 'Updated Successfully';

?>