问题描述
通过参考这里的问题,
我想建立一个搜索和登录请求从我的Android项目的OpenERP。这个我在做什么,
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);
}
更新:
OpenErpConnect op = OpenErpConnect.connect("http://192.168.100.29:8069/", 8069, "DevDB", "admin", "openerp");
而在XMLRPClient,
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);
不过,我总是得到响应为HTML文件。我不知道我要去的地方错了。
任何机构可以帮帮我吗?
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?
更新:
首先,我真的很抱歉从这里继续。但是因为我原来的问题是关于搜索,我只能继续在这里。请原谅。
First, I'm really sorry to continue from here. But because my original question was regarding to search, I continue here only. Please apologize.
我能现在有了这个code登录,
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);
我得到的错误,
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
你能帮助我吗?
推荐答案
您正在请求错误的URI。网址应 http://192.168.100.29:8069/xmlrpc/object
来过OpenERP的对象执行任何功能。
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
这篇关于不能登录的OpenERP在android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!