我有以下Codeigniter XML RPC代码用于在 OpenERP 数据库中搜索客户,
我遵循此文档来实现搜索
以下代码工作正常并检索 res.partner 表中的所有记录
$this->xmlrpc->server('http://localhost/xmlrpc/object',8314);
$this->xmlrpc->method('execute');
//$this->xmlrpc->set_debug(TRUE);
$request = array (
array($this->database, 'string'),
array($this->userid , 'int'),
array($this->password, 'string'),
array("res.partner", 'string'),
array('search', 'string'),
array(array(), 'array'),
);
$this->xmlrpc->request($request);
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
return -1;
}
else
{
//print_r( $this->xmlrpc->display_response());
$val = $this->xmlrpc->display_response();
return $val;
}
现在我只想得到与name=abc
$this->xmlrpc->server('http://localhost/xmlrpc/object',8314);
$this->xmlrpc->method('execute');
//$this->xmlrpc->set_debug(TRUE);
$attribute = "name";
$operator = "=";
$keys="abc";
$key = array(
new XML_RPC_Values(array(
new XML_RPC_Values($attribute , "string"),
new XML_RPC_Values($operator,"string"),
new XML_RPC_Values($keys,"string"))
,"array"),
);
$request = array (
array($this->database, 'string'),
array($this->userid , 'int'),
array($this->password, 'string'),
array("res.partner", 'string'),
array('search', 'string'),
$key,
);
$this->xmlrpc->request($request);
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
return -1;
}
else
{
//print_r( $this->xmlrpc->display_response());
$val = $this->xmlrpc->display_response();
return $val;
}
这不起作用,并且出现以下错误
A PHP Error was encountered
Severity: Notice
Message: Object of class XML_RPC_Values could not be converted to int
Filename: libraries/Xmlrpc.php
Line Number: 1216
A PHP Error was encountered
Severity: 4096
Message: Object of class XML_RPC_Values could not be converted to string
Filename: libraries/Xmlrpc.php
Line Number: 1360
结果相同 检索 res.partner 表的所有记录