Hi Friends ,
I am learning OpenERP XML-RPC API for JAVA, I tried some code, but the READ operation is not working for me .
I am using IDE - Java Eclipse & my program looks like
package TalendDemo;
import java.net.URL;
import java.util.HashMap;
import java.util.Vector;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class Read {
@SuppressWarnings("unchecked")
public static void main(String args[]) throws Exception {
try {
XmlRpcClient client = new XmlRpcClient();
XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
clientConfig.setEnabledForExtensions(true);
clientConfig.setServerURL(new URL("http", "localhost", 8069,
"/xmlrpc/object"));
client.setConfig(clientConfig);
Vector<Object> arg = new Vector<Object>();
arg.add("Talend"); // DB name
arg.add(1); // used_id
arg.add("admin1234"); // DB password
arg.add("res.partner"); // table
arg.add("read");
arg.add(5); // Table id
arg.add("name"); // column name
HashMap<Object, Object> ids = new HashMap<Object, Object>();
ids = (HashMap<Object, Object>) client.execute("execute", arg);
System.out.println(ids);
System.out.println(ids.size());
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Output :
{id=5}
1
My Question is the output be Returns: the id of each record and the values of the requested field. But my return type is different. What is problem , help me ...
Thanks & Regards
OMPRAKASH.A
You could also try this lib : https://github.com/DeBortoliWines/openerp-java-api