zikzakmedia / android-openerp Goto Github PK
View Code? Open in Web Editor NEWAndroid class connect to OpenERP (webservices)
Android class connect to OpenERP (webservices)
Hi,I try use your android-openerp class but i have an issue.
I'm using OpenErp v7
My code:
OpenErpConnect x=OpenErpConnect.login(servername, port_server, db_name,username, pass);
Long[] ids = x.search("res.partner",true, new Object[0]);
System.out.println("IDS="+ids);
servername, port_server, db_name, username and pass are correctly defined.I can connect with my openerp perfectly.
I can execute the methods of read or write(if you know the ids) and works! , but when i try searching the ids happens this:
01-10 11:38:18.833: W/System.err(1028): java.io.IOException: Cannot serialize null
01-10 11:38:18.833: W/System.err(1028): at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:99)
01-10 11:38:18.843: W/System.err(1028): at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:61)
01-10 11:38:18.853: W/System.err(1028): at org.xmlrpc.android.XMLRPCCommon.serializeParams(XMLRPCCommon.java:36)
01-10 11:38:18.863: W/System.err(1028): at org.xmlrpc.android.XMLRPCClient.methodCall(XMLRPCClient.java:250)
01-10 11:38:18.874: W/System.err(1028): at org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:170)
01-10 11:38:18.874: W/System.err(1028): at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:281)
01-10 11:38:18.883: W/System.err(1028): at packet.OpenErpConnect.search(OpenErpConnect.java:184)
01-10 11:38:18.883: W/System.err(1028): at packet.OpenErpConnect.search(OpenErpConnect.java:153)
01-10 11:38:18.883: W/System.err(1028): at packet.MainActivity$1.onClick(MainActivity.java:66)
01-10 11:38:18.893: W/System.err(1028): at android.view.View.performClick(View.java:3511)
01-10 11:38:18.893: W/System.err(1028): at android.view.View$PerformClick.run(View.java:14105)
01-10 11:38:18.913: W/System.err(1028): at android.os.Handler.handleCallback(Handler.java:605)
01-10 11:38:18.913: W/System.err(1028): at android.os.Handler.dispatchMessage(Handler.java:92)
01-10 11:38:18.913: W/System.err(1028): at android.os.Looper.loop(Looper.java:137)
01-10 11:38:18.913: W/System.err(1028): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-10 11:38:18.933: W/System.err(1028): at java.lang.reflect.Method.invokeNative(Native Method)
01-10 11:38:18.933: W/System.err(1028): at java.lang.reflect.Method.invoke(Method.java:511)
01-10 11:38:18.953: W/System.err(1028): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-10 11:38:18.964: W/System.err(1028): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-10 11:38:18.973: W/System.err(1028): at dalvik.system.NativeStart.main(Native Method)
01-10 11:38:18.983: D/OpenErpConnect(1028): org.xmlrpc.android.XMLRPCException: java.io.IOException: Cannot serialize null
01-10 11:38:18.983: I/System.out(1028): IDS=null
the line 184:
Method Search:
if (count) { // We just want the number of items
result = new Long[] { ((Integer)client.call("execute", parameters)).longValue() };<----.------THIS
} else { // Returning the list of matching item id's
the line 153
public Long[] search(String model, boolean count, Object[] conditions) {
return search(model, count, 0, 0, null, false, conditions);<------------------THIS
}
You add a parameter with value=null: parameters.add(null);
this null is the problem? another parameters in theory aren't null....
Cheers!
using testConnection method i try to test the connection but it returns false.
passing values are correct.
Hi,
I download your last code and try to search, here is the code:
TextView TextDisplay = (TextView) findViewById(R.id.textView1);
OpenErpConnect oc = OpenErpConnect.connect("localhost", 8069, "testdb", "admin", "admin");
Long[] ids = oc.search("res.users", true, new Object[0]);
String result = "";
for(int index = 0; index < ids.length ; index++) {
result += ids[index] + "\n";
}
TextDisplay.setText(result);
But its always error with message: cannot serialize null (same as the first and closed issue).
Also, I think you need to update your README file...
when I call method search like:
Long[] task_detail_img_ids = oc.search("task.detail.img",true, new Object[0]);
it's return xmlexception
03-01 12:41:01.250: W/System.err(674): java.io.IOException: Cannot serialize null
03-01 12:41:01.260: W/System.err(674): at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:99)
03-01 12:41:01.260: W/System.err(674): at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:61)
03-01 12:41:01.270: W/System.err(674): at org.xmlrpc.android.XMLRPCCommon.serializeParams(XMLRPCCommon.java:37)
03-01 12:41:01.270: W/System.err(674): at org.xmlrpc.android.XMLRPCClient.methodCall(XMLRPCClient.java:254)
03-01 12:41:01.280: W/System.err(674): at org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:171)
03-01 12:41:01.290: W/System.err(674): at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:285)
03-01 12:41:01.300: W/System.err(674): at os.cm.openerp.method.OpenErpConnect.search(OpenErpConnect.java:176)
03-01 12:41:01.300: W/System.err(674): at os.cm.openerp.method.OpenErpConnect.search(OpenErpConnect.java:143)
03-01 12:41:01.310: W/System.err(674): at os.cm.activity.ImageListView.onOptionsItemSelected(ImageListView.java:326)
03-01 12:41:01.320: W/System.err(674): at android.app.Activity.onMenuItemSelected(Activity.java:2195)
03-01 12:41:01.320: W/System.err(674): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
03-01 12:41:01.331: W/System.err(674): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
03-01 12:41:01.340: W/System.err(674): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
03-01 12:41:01.340: W/System.err(674): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
03-01 12:41:01.350: W/System.err(674): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
03-01 12:41:01.350: W/System.err(674): at android.view.View$PerformClick.run(View.java:8816)
03-01 12:41:01.360: W/System.err(674): at android.os.Handler.handleCallback(Handler.java:587)
03-01 12:41:01.370: W/System.err(674): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 12:41:01.370: W/System.err(674): at android.os.Looper.loop(Looper.java:123)
03-01 12:41:01.380: W/System.err(674): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-01 12:41:01.390: W/System.err(674): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 12:41:01.390: W/System.err(674): at java.lang.reflect.Method.invoke(Method.java:521)
03-01 12:41:01.400: W/System.err(674): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-01 12:41:01.400: W/System.err(674): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-01 12:41:01.410: W/System.err(674): at dalvik.system.NativeStart.main(Native Method)
03-01 12:41:01.420: D/OpenErpConnect(674): org.xmlrpc.android.XMLRPCException: java.io.IOException: Cannot serialize null
03-01 12:45:29.300: I/------------------ LOGIN FAILED 1(674): java.lang.NullPointerException
How to resolve?
Hi Enric Caumons
I try using your OpenErpConnect.java class and successful in using Create(), Read() methods. But I can't use your Search() method, it always returns null value.
My code is:
oec = OpenErpConnect.connect("192.168.0.106", 8069, "Chill", "admin", "1");
Long[] ids = oec.search("pos.category", new Object[0]);
My params is:
[Chill, 1, 1, pos.category, search, [Ljava.lang.Object;@40f5c5c0, 0, 0, null, null, false]
Thanks
I am struggling with this issue, my search finally works, but only works in the login activity where i created my openerp object, then i pass that object as an extra to other activity, i verify that all the data is alright printing it... seems ok, but when i try to do anything like search, read, testconnection... it fails. I don't know if i am missing something here.
Hi,
I am using your OpenErpConnect Class to login to the server. But I always get an html in the response. Response code is 200, but ends with html.
Below is my code,
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 in the third line it is failing to login
Can any body tell me where I am going wrong. I am struggling from days for this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.