Cannot Login to OpenERP in android

你离开我真会死。 提交于 2019-12-13 04:59:25

问题


With reference to the question here,

Android OpenErp Search Request XMLRPC

I am trying to establish a search and login request to OPENERP from my android project. This what I am doing,

    private URI uri;
    uri = URI.create("http://192.168.100.29:8069");
    client = new XMLRPCClient(uri);

    Array[] arr;
    arr = (Array[]) client.call("search", "DevDB", "admin",
                "password", "product.product", "execute");


   HttpResponse response;
   response = client.execute(postMethod); 

   String res = null;
     if (null != response) {
            HttpEntity resEntity = response.getEntity();
            res = EntityUtils.toString(resEntity);
        }

Update:

 OpenErpConnect op = OpenErpConnect.connect("http://192.168.100.29:8069/", 8069, "DevDB", "admin", "openerp");

And in XMLRPClient,

    URL loginUrl = new URL("http://192.168.100.29:8069/");
    XMLRPCClient client = new XMLRPCClient(loginUrl);
    Integer id = (Integer)client.call("login", db, user, pass);
    connection = new OpenErpConnect(server, port, db, user, pass, id);

But I always get the response as a html file. I don't know where I am going wrong. Can any body please help me?

Update:

First, I'm really sorry to continue from here. But because my original question was regarding to search, I continue here only. Please apologize.

I am able to login with this code now,

       OpenErpConnect localOpenErpConnect = new OpenErpConnect(
                paramString1, paramString2, paramInteger, paramString3,
                paramString4, paramString5,
                (Integer) new XMLRPCClient(new URL(paramString1,
                        paramString2, paramInteger.intValue(),
                        "/xmlrpc/common")).call("login", paramString3,
                        paramString4, paramString5));

But when I do search request like this,

        Long[] ids = conn.search("product.product", new Object[0]);
        System.out.println(ids); 


        Object[] responseIds = (Object[]) client.call("execute",
                    parameters);

I'm getting the error that,

            Traceback (most recent call last):
                  File "/opt/openerp/v7/server/openerp/service/wsgi_server.py", line 82,      in xmlrpc_return
             result = openerp.netsvc.dispatch_rpc(service, method, params)
            File "/opt/openerp/v7/server/openerp/netsvc.py", line 292, in dispatch_rpc
            result = ExportService.getService(service_name).dispatch(method, params)
            File "/opt/openerp/v7/server/openerp/service/web_services.py", line 611, in dispatch
             (db, uid, passwd ) = params[0:3]
         ValueError: need more than 1 value to unpack

Can you help me?


回答1:


you are making request to wrong URI. URL should be http://192.168.100.29:8069/xmlrpc/object to execute any function over openerp object.

You can also refer to this link. https://doc.openerp.com/6.0/de/developer/6_22_XML-RPC_web_services/#java



来源:https://stackoverflow.com/questions/20794411/cannot-login-to-openerp-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!