Well, I just figured it out using the XMLRPC library. It's not the exact library as you, but I think maybe what I share here can help. Here is some sample code:
// set up the overall message parameters
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval(self::DBNAME, "string"));
$msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval(self::PASSWORD, "string"));
$msg->addParam(new xmlrpcval($someObject->getOpenERPName(), "string"));
$msg->addParam(new xmlrpcval("write", "string"));
$msg->addParam(new xmlrpcval($someObject->getId(),"int"));
// prep the many2many data
// yes, this is ridiculous, and hard to understand!
$m2m = new xmlrpcval(
array(
new xmlrpcval(
array(
new xmlrpcval(6,"int"),
new xmlrpcval(0,"int"),
new xmlrpcval(
array(
new xmlrpcval(35,"int"), // id of the object at the other side of the relation
new xmlrpcval(52,"int"), // id of the object at the other side of the relation
),"array")
), "array")
),"array");
// package all the data
$data = array(
"field1"=>new xmlrpcval($someObject->getField1(),"string"),
"field2"=>new xmlrpcval($someObject->getField2(),"int"),
"field3"=>$m2m,
);
// add the data to the message
$msg->addParam(new xmlrpcval($data,"struct"));
// send the message
$client_object = new xmlrpc_client(
"http://".self::HOST.":".self::PORT."/xmlrpc/object"
);
$resp = $client_object->send($msg);
Basically, you have to have a structure that is [[6,0,[id1,id2,id3,etc.]]]
. With XMLRPC, the values all have to be properly packed in xmlrpcval objects and it ends up being very hard to read.
In the system I'm building, I've packaged all this up and refactored it into some helper functions so that it's not quite so hard to understand what is going on. Still, it's a pain in the butt!