Hi Friends
I am learning XML-RPC API for JAVA, I tried some code, but the SEARCH,SEARCH_COUNT, etc operation is not working for me .
I am using IDE - Java Eclipse & my program looks like
public static void main(String[] args) throws MalformedURLException, XmlRpcException {
final XmlRpcClient client = new XmlRpcClient();
final XmlRpcClient models = new XmlRpcClient();
final XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
common_config.setServerURL(
new URL(String.format("%s/xmlrpc/2/common", url)));
client.execute(common_config, "version", emptyList());
int uid = (int) client.execute(
common_config, "authenticate", asList(
db, username, password, emptyMap()));
Integer count=(Integer)models.execute("execute_kw", asList(
db, uid, password,"res.partner", "search_count", asList(asList())));
System.out.println(count);
}
}
Output:
Exception in thread "main" java.lang.NullPointerException
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:32)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)