您好我目前正在编写一个使用Apache XML-RPC连接到 OpenERP 的 servlet。周围没有任何好的资源,Java 示例非常简约,并且在 OpenERP 站点上还远未完成。
有没有人知道我可以在哪里找到关于如何以及在 OpenERP 端调用什么的 API?
我真的很感激!!!
进一步说明,我正在专门寻找有关如何使用 java 输入多个 id 来“读取”数据的语法。
XmlRpcClient client = new XmlRpcClient();
XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
clientConfig.setEnabledForExtensions(true);
clientConfig.setServerURL(new URL(urlStringObject));
client.setConfig(clientConfig);
Object[] params2 = { "city", "name", "email", "create_date","write_date" };
Vector<Object> arg = new Vector<Object>();
arg.add(database);
arg.add(1);
arg.add(password);
arg.add("res.partner.address");
arg.add("read");
arg.add(9); // <- THE PYTHON SYNTAX SAYS input 'LIST OF IDS' here What is the Jave equivalent???
arg.add(params2);
HashMap ids = (HashMap) client.execute("execute", arg);
更新
/* Search for all ids */
xmlrpcConfigLogin.setServerURL(new URL(urlStringObject));
Object[] searchQuery = new Object[] {"id", "!=", -1 };
Vector queryVector = new Vector();
queryVector.addElement(searchQuery);
Object[] params = new Object[] { database, theloginId , password, tableName, "search", queryVector };
Object[] po_ids = (Object[]) xmlrpcLogin.execute("execute", params);
/* Send Read Query */
Object[] readQuery = {"name"};
Vector<Object> arg = new Vector<Object>();
arg.add(database);
arg.add(1);
arg.add(password);
arg.add(tableName);
arg.add("read");
arg.add(po_ids);
arg.add(readQuery);
HashMap globalMap = new HashMap();
Object[] hm = (Object[]) xmlrpcLogin.execute("execute", arg);
for (Object object : hm) {
HashMap hash = (HashMap)object;
globalMap.put("name", hash.get("name"));
_log.info(hash.get("name"));
}
如您所见:它需要一个 ID 的 Object[] 作为输入(po_ids)