import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Vector;
/*
* Requires apache-xmlrpc-3.1.3 from http://ws.apache.org/xmlrpc/client.html
*/
public class Main {
public static void main(String[] args) throws MalformedURLException, XmlRpcException {
System.out.println("OpenERP Java XMLRPC Test Client");
XmlRpcClient xmlRpcLogin = new XmlRpcClient();
XmlRpcClientConfigImpl xmlRpcLoginConfig = new XmlRpcClientConfigImpl();
/*
* 1. First step, login
*/
xmlRpcLoginConfig.setServerURL(new URL("http", "127.0.0.1", 8069, "/xmlrpc/common"));
xmlRpcLogin.setConfig(xmlRpcLoginConfig);
Vector<String> params = new Vector<String>();
params.add("db_test_session");
params.add("admin"); // login
params.add("admin"); // password
Object id = xmlRpcLogin.execute("login", params);
System.out.printf("User login : %s\n",id);
/*
* 2. Search
*/
// ...
}
}