XMLRPC java insert issue

Posted by Sanjai Palliyil on Stack Overflow See other posts from Stack Overflow or by Sanjai Palliyil
Published on 2012-06-20T04:36:35Z Indexed on 2012/06/21 3:17 UTC
Read the original article Hit count: 464

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about xml-rpc