1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
import java.net.MalformedURLException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.util.ArrayList;
import java.net.URL;
import java.util.HashMap;
import java.util.Vector;
import org.apache.xmlrpc.XmlRpcException;
public class example {
public static void main(String[] args) throws MalformedURLException, XmlRpcException {
OpenERP open = new OpenERP("localhost", "test", "admin", "azerty");
boolean resultat =false;
resultat= open.loginOpenERP("admin", "azerty");
System.out.println(resultat);
XmlRpcClient client = new XmlRpcClient();
Vector<String> res = new Vector<String>();
Object[] search_detail = new Object[]{"id", "=", "1"};
Object[] search = new Object[]{search_detail};
Object[] param = new Object[] {"test",1,"admin", "product.product", "search", search};
Object recu =client.execute("execute", param);
Object[] a = (Object[]) recu;
for (int i = 0; i < a.length; i++)
if ((a[i] instanceof String) || (a[i] instanceof Integer))
res.add((a[i]).toString());
System.out.print(res);
}
} |
Partager