title: "read" Data with multiple IDs from OpenERP using java with apache xml-rpc
body: <p>Hi I am currently writing a servlet using <a href="http://ws.apache.org/xmlrpc/index.html" rel="nofollow">Apache XML-RPC</a> connecting to OpenERP. There are not any good resources around, and the java examples are very minimalistic and far from complete on the OpenERP site. </p>
  
  <p>Has anyone a clue where I could find an API on how and what I can call on the OpenERP side?</p>
  
  <p>I would really appreciate that!!!</p>
  
  <p>On a further note, I am specifically looking for the syntax on how to "read" data, using java, with an input of multiple ids.</p>
  
  <pre><code>XmlRpcClient client = new XmlRpcClient();
  XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
  clientConfig.setEnabledForExtensions(true);
  clientConfig.setServerURL(new URL(urlStringObject));
  client.setConfig(clientConfig);
  
  Object[] params2 = { "city", "name", "email", "create_date","write_date" };
  
  Vector&lt;Object&gt; arg = new Vector&lt;Object&gt;();
  
  arg.add(database);
  arg.add(1);
  arg.add(password);
  arg.add("res.partner.address");
  arg.add("read");
  arg.add(9); // &lt;- THE PYTHON SYNTAX SAYS input 'LIST OF IDS' here What is the Jave equivalent???
  arg.add(params2);
  
  HashMap ids = (HashMap) client.execute("execute", arg);
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>/* Search for all ids */
                  xmlrpcConfigLogin.setServerURL(new URL(urlStringObject));
                  Object[] searchQuery = new Object[] {"id", "!=", -1 };
  
                  Vector queryVector = new Vector();
                  queryVector.addElement(searchQuery);
  
                  Object[] params = new Object[] { database, theloginId , password, tableName, "search", queryVector };
                  Object[] po_ids = (Object[]) xmlrpcLogin.execute("execute", params);                
  
                  /* Send Read Query */
                  Object[] readQuery = {"name"};      
  
                  Vector&lt;Object&gt; arg = new Vector&lt;Object&gt;();      
                  arg.add(database);
                  arg.add(1);
                  arg.add(password);
                  arg.add(tableName);
                  arg.add("read");
                  arg.add(po_ids);
                  arg.add(readQuery);         
  
                  HashMap globalMap = new HashMap();
  
                  Object[] hm = (Object[]) xmlrpcLogin.execute("execute", arg);                                   
                  for (Object object : hm) {
                      HashMap hash = (HashMap)object;                             
                      globalMap.put("name", hash.get("name"));              
                      _log.info(hash.get("name"));
                  }       
  </code></pre>
  
  <p>As you can see: It takes an Object[] of ids as input (po_ids)</p>