Odoo Help


How to access ODOO 8 using Java xmlrpc?

IGAM Muliarsa
on 4/12/15, 4:01 AM 5,765 views

i follow this documentation https://www.odoo.com/documentation/8.0/api_integration.html to connect java to odoo 8 web services.

I tried both online and localhost, but none are working.

  1. http://localhost:8069/start nor https://demo.odoo.com/start

  2. http://localhost:8069/xmlrpc nor https://demo.odoo.com/xmlrp 

  3. http://localhost:8069/xmlrpc/2/common nor https://demo.odoo.com/xmlrpc/2/common

the error said no url found/exist.

org.apache.xmlrpc.client.XmlRpcHttpTransportException: HTTP server returned unexpected status: NOT FOUND 


IGAM Muliarsa

Here is my source code:

import java.net.MalformedURLException;
import java.net.URL;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class TestOdoo {
      public static void main(String[] args) {
           //String url = "http://localhost:8069/xmlrpc/common";
           String url = "https://demo.odoo.com";
           //String url = "https://demo.odoo.com/start";
           XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
           try {
                 config.setServerURL(new URL(url+"/xmlrpc/2/common"));
           } catch (MalformedURLException e) {
           XmlRpcClient client = new XmlRpcClient();
          Object[] params = new Object[]{"test", "admin", "admin"}; Object res;
          try {
              res = client.execute("login", params);
          } catch (XmlRpcException e) {
      } }

Yeah, not much happens here ;)

Dr Obx
on 4/15/15, 4:10 AM
IGAM Muliarsa
On 4/14/15, 10:48 PM

Nobody is active on in these forum...... btw I found the solution. here is the source to whom concern or need the source code. don't forget to import library required to test this source... documentation on https://www.odoo.com/documentation/8.0/api_integration.html will not work at all.

 public static void main(String[] args) throws MalformedURLException, XmlRpcException {
      String url = ""; // work with odoo.com account!!
      String db = "test";
      String username = "admin";
      String password = "admin";
      System.out.println("Get database list");
      int uid = login(url,db,username,password);
      if (uid >0) {
          System.out.println("Login Ok");
      } else {
           System.out.println("Login Fail");
// login
static int login(String url, String db, String login, String password) throws XmlRpcException, MalformedURLException {
      XmlRpcClient client = new XmlRpcClient();
      XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
      //config.setServerURL(new URL(url+"/xmlrpc/common"));
      config.setServerURL(new URL(url+"/xmlrpc/2/common"));
      //Object[] empty = null; // Ok
      //Object[] params = new Object[] {db,login,password, empty}; // Ok
      Object[] params = new Object[] {db,login,password}; // Ok & simple
      Object uid = client.execute("login", params);
      if (uid instanceof Integer)
          return (int) uid;
      return -1;

What jar file u had used for this, can u share a link also

Ashish Singh
on 5/26/15, 12:41 AM

Thx IGAM Muliarsa for sharing

on 4/25/16, 6:30 PM

Thank you IGAM Muliarsa very much! Finally I have a working Kotlin code to access OpenERP.

Andrei Levin
on 11/8/17, 3:39 PM

you're welcome. nice to hear the code work :)

IGAM Muliarsa
on 11/10/17, 9:15 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/12/15, 4:01 AM
Seen: 5765 times
Last updated: 4/22/15, 5:03 AM