I am trying to insert customer details into OpenERP server using XMLPRC and java. I am able to do an authentication. But when i call the execute method to insert the record by passing the parameters, am getting Exception in thread “main” java.lang.NullPointerException on line res_create = client_1.execute(“execute”, params_create);
Please find my code below
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(); }Any helps is appreciated
If you are able to authentication that means you have working XMLRPC connection, now in case of authentication the OpenERP Services you will be using is common service so you will have client object which will be proxy to
http://host:posrt/xmlrpc/commonthat is perfectly right.But if you want to do any operation on any of the OE Model then for that OE Provides Separate services that is
OBJECTservice so in that case your client object must be proxy tohttp://host:port/xmlrpc/objectand then you can call execute method on it, you can see we do not have execute method implemented for the common service on link http://bazaar.launchpad.net/~openerp/openobject-server/trunk/view/head:/openerp/service/web_services.py#L379For more you can see OE and JAVA
I have Prepared Some scartch code you try in case
}