我正在尝试使用 XMLPRC 和 java 将客户详细信息插入 OpenERP 服务器。我能够进行身份验证。但是,当我通过传递参数调用执行方法来插入记录时,在线程“main”java.lang.NullPointerException 中出现异常 res_create = client_1.execute("execute", params_create);
请在下面找到我的代码
res = client.execute("login", params);
String url_1 = "http://agilewebdevelopment.net:8514/xmlrpc/object";
XmlRpcClientConfigImpl config_1 = new XmlRpcClientConfigImpl();
try {
config_1.setServerURL(new URL(url_1));
} catch (MalformedURLException e) {
System.out.println("First");
e.printStackTrace();
}
System.out.println(res);
HashMap<String, Object> vals = new HashMap<String, Object>();
vals.put("name", "Mantavya Gajjar");
vals.put("ref", "MGA");
XmlRpcClient client_1 = new XmlRpcClient();
client.setConfig(config_1);
Object[] params_create = new Object[]{"erp_performance", "1", "admin", "res.partner", "create", vals};
Object res_create = null;
try {
res_create = client_1.execute("execute", params_create);
} catch (XmlRpcException e) {
e.printStackTrace();
}
任何帮助表示赞赏