Hello all,
I try to get "read" working thru xmlrpc with PHP but the only response I get is this kind of stuff (PHP print_r):
xmlrpcresp Object ( [val] => xmlrpcval Object ( [me] => Array ( [struct] => Array ( [id] => xmlrpcval Object ( [me] => Array ( [string] => 0 ) [mytype] => 1 [_php_class] => ) ) ) [mytype] => 3 [_php_class] => ) [valtyp] => xmlrpcvals [errno] => 0 [errstr] => [payload] => [hdrs] => Array ( [content-type] => text/xml [content-length] => 196 [server] => Werkzeug/0.8.3 Python/2.7.3 [date] => Sat, 05 Jul 2014 16:25:04 GMT ) [_cookies] => Array ( ) [content_type] => text/xml [raw_data] => HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 196 Server: Werkzeug/0.8.3 Python/2.7.3 Date: Sat, 05 Jul 2014 16:25:04 GMT id 0 )
Response is empty (I mean, does not return fields)
For now I managed to login + search or create methods.
Does somebody have a short example for read method that works ?
Thank You
Hello, try this $msg = new xmlrpcmsg('execute'); $msg->addParam(new xmlrpcval($dbname, "string")); $msg->addParam(new xmlrpcval($userId, "int")); $msg->addParam(new xmlrpcval($password, "string")); $msg->addParam(new xmlrpcval($relation, "string")); $msg->addParam(new xmlrpcval("read", "string")); $msg->addParam(new xmlrpcval($id, "array")); $msg->addParam(new xmlrpcval($fields, "array")); With fields are array of fields you want
And when you try the response is this? It must have a mistake.The good response is something like an array of struct or an array of array i don t remember exactly. With id is the key and the struct is make of field1=value1 field2=value2 etc
Yes response is the one above. But this is an array of arrays . The "struct" one is already on first line but it does not contain the fields I read ("name")
$partner_id = "10"; $id_list = array(new xmlrpcval($partner_id, "int")); $key = array( 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.partner", "string")); $msg->addParam(new xmlrpcval("read", "string")); $msg->addParam(new xmlrpcval($id_list, "array")); $msg->addParam(new xmlrpcval($key, "array"));