dseslyh6662605 2014-10-25 14:53
浏览 179

odoo,通过xml-rpc访问并且正确

yesterday,I worked to develop a xmlrpc to my ecommerce software to odoo. Follow a odoo general error, i reinstall odoo.

I don't touch nothing and I have this error now and I am in Administrator. Maybe I forget something or there is a litlle changement in the odoo code ????

Thank

Fatal error: Call to a member function scalarval() on a non-object in /home/www/clicshopping_test_ui/boutique/ClicCpanel/ext/odoo_xmlrpc/xml_rpc_admin_customers.php on line 173

print_r($response) do that :

object(xmlrpcresp)[36]
public 'val' => int 0
public 'valtyp' => null
public 'errno' => int -1
public 'errstr' => string '' (length=0)
public 'payload' => null
public 'hdrs' => 
array (size=4)
'content-type' => string 'text/xml' (length=8)
'content-length' => string '446' (length=3)
'server' => string 'Werkzeug/0.9.6 Python/2.7.8' (length=27)
'date' => string 'Sat, 25 Oct 2014 14:45:31 GMT' (length=29)
public '_cookies' => 
array (size=0)
empty
public 'content_type' => string 'text/xml' (length=8)
public 'raw_data' => string 'HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 446
Server: Werkzeug/0.9.6 Python/2.7.8
Date: Sat, 25 Oct 2014 14:45:31 GMT

<?xml version='1.0'?>

faultCode warning -- AccessError

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: res.partner, Operation: read)

faultString

my xml-rpc

// **********************************
// search iso code ClicShopping
// **********************************

$QcountryIdCustomer = $OSCOM_PDO->prepare("select entry_country_id
                                           from :table_address_book
                                           where customers_id = :customers_id
                                          ");
$QcountryIdCustomer->bindInt(':customers_id', (int)$customers_id );
$QcountryIdCustomer->execute();

$country_id_customer = $QcountryIdCustomer->fetch();
$country_id_customer = $country_id_customer['entry_country_id'];


$QcountryCode = $OSCOM_PDO->prepare("select countries_iso_code_2
                                     from :table_countries
                                     where countries_id = :countries_id
                                    ");
$QcountryCode->bindInt(':countries_id',(int)$entry_country_id);
$QcountryCode->execute();

$country_code = $QcountryCode->fetch();
$country_code = $country_code['countries_iso_code_2'];
// **********************************
// search id country odoo
// **********************************

$domain_filter = array (
  new xmlrpcval(
    array(
      new xmlrpcval('code' , "string"),
      new xmlrpcval('=',"string"),
      new xmlrpcval($country_code,"string"),
    ),"array"
  ),
);

$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.country", "string"));

$msg->addParam(new xmlrpcval("search", "string"));
$msg->addParam(new xmlrpcval($domain_filter, "array"));
$response = $client->send($msg);

if ($response->faultCode()){
  echo $response->faultString();
}

$result = $response->value();

$ids = $result->scalarval();

$id_list = array();
/*
for($i = 0; $i < count($ids); $i++){
$id_list[]= new xmlrpcval($ids[$i]->me['int'], 'int');
}
*/
$id_list[]= new xmlrpcval($ids[0]->me['int'], 'int');

$field_list = array(new xmlrpcval("country_id", "int"),
                    new xmlrpcval("name", "string"),
);

$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.country", "string"));
$msg->addParam(new xmlrpcval("read", "string"));
$msg->addParam(new xmlrpcval($id_list, "array"));
$msg->addParam(new xmlrpcval($field_list, "array"));

$resp = $client->send($msg);

$result = $resp->value()->scalarval();
/*
for($i = 0; $i < count($result); $i++){
$country_id_odoo = ($result[$i]->me['struct']['id']->me['int']);
}
*/
$country_id_odoo = $result[0]->me['struct']['id']->me['int'];

// **********************************
// Search odoo customer id
// **********************************

$domain_filter = array (
  new xmlrpcval(
    array(
      new xmlrpcval('ref' , "string"),
      new xmlrpcval('=',"string"),
      new xmlrpcval('WebStore - ' . $customers_id,"string"),
    ),"array"
  ),
);

$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("search", "string"));
$msg->addParam(new xmlrpcval($domain_filter, "array"));
$response = $client->send($msg);

$result = $response->value();
$ids = $result->scalarval();

$id_list = array();
/*
for($i = 0; $i < count($ids); $i++){
$id_list[]= new xmlrpcval($ids[$i]->me['int'], 'int');
}
*/
$id_list[]= new xmlrpcval($ids[0]->me['int'], 'int');

$field_list = array(new xmlrpcval("ref", "string"),
                    new xmlrpcval("id", "int"),
                  );

$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("read", "string"));
$msg->addParam(new xmlrpcval($id_list, "array"));
$msg->addParam(new xmlrpcval($field_list, "array"));

$response = $client->send($msg);

if ($response->faultCode()){
  echo $response->faultString();
}
line 170
$result = $response->value()->scalarval();
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题