0

I'm trying to connect with openERP with the library that openERP or odoo uses with their examples. But the Apache library of xmlrpc, I can't find it.

Here is the documentation that openERP gives but they use the apache library : https://www.odoo.com/documentation/8.0/api_integration.html

And the library should be downloadable from : http://www.apache.org/dyn/closer.cgi/ws/xmlrpc/

But the link gives me 404 error's, does anyone know a good library/documentation to get it work with an android device?

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    OpenErpConnect oc = OpenErpConnect.connect("2x7.13x.xxx.xxx", 8069, "DBNAME", "admin", "xxxxxxxxxxxxxxxx");
    List<HashMap<String, Object>> list = oc.read("res.partners", new Integer[] {1, 2, 3}, new String[] {"name"});
    String result = "";
    for (HashMap<String, Object> item : list) {
        result += (String)item.get("name")+"\n";
    }
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
}
Mike-Bell
  • 951
  • 1
  • 11
  • 25
Theo Jansen
  • 81
  • 1
  • 4
  • 11

1 Answers1

0

Have you tried aXMLRPC? Looks pretty powerful and simple: https://github.com/timroes/aXMLRPC

Mike-Bell
  • 951
  • 1
  • 11
  • 25
  • Ye tried that already but it gives me a crash when I try to make connection with openERP. – Theo Jansen Mar 03 '15 at 11:11
  • Please provide the crash stack trace – Mike-Bell Mar 03 '15 at 11:14
  • I included the aXMLRPC library, this does not give me an error. But i'm now implementing the https://github.com/zikzakmedia/android-openerp class. And when I try to connect to openERP with that aXMLRPC library it can't get userid in the call.java. In my mainactivity I do: OpenErpConnect oc = OpenErpConnect.connect("ip", port, "dbname", "admin", "pw"); In the openERPconnect class there is a line : Integer id = (Integer)client.call("login", db, user, pass); which goes to the call action of XMLRPCclient which gives me an exception. – Theo Jansen Mar 03 '15 at 11:56
  • That library depends on http://code.google.com/p/android-xmlrpc/ not aXMLRPC. Please provide the full exception. – Mike-Bell Mar 03 '15 at 11:59
  • Implemented that library now, still tells me that my login connection for getting the id , my connection is refused. I'm pretty sure that the information I fill in the mainactivity is correct. – Theo Jansen Mar 03 '15 at 12:13
  • This is a NullPointerException, not necessarily related to a communication problem. You should provide the full code of your MainActivity. – Mike-Bell Mar 03 '15 at 12:23
  • I posted my mainactivity. – Theo Jansen Mar 03 '15 at 12:35
  • 1
    You can't do http connections on the main UI thread, use AsyncTask to connect and request data from a remote server. Also note that you're not checking if the connection was successful. Please refer to http://developer.android.com/reference/android/os/AsyncTask.html – Mike-Bell Mar 03 '15 at 12:41
  • Ye tried that but still doens't change anything. I still cannot get any info out of openERP – Theo Jansen Mar 03 '15 at 12:53