zikzakmedia / android-openerp

Android class connect to OpenERP (webservices)
15 stars 21 forks source link

problem with search method #1

Closed kathawut closed 12 years ago

kathawut commented 12 years ago

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?

caumons commented 12 years ago

I have just done a commit which includes new functionality. I also have had a look at the issue you describe and included the fix in the commit. In search() method I was using boolean count instead of Boolean count; where Boolean is seralizable and boolean is not. Notice that all parameters that I am sending to OpenERP are serialized except this, so I think this should solve the problem. Please tell me if this works. Cheers!

kathawut commented 12 years ago

It willl error when parameter is NULL .I saw null parameter in openerpconnect.java On Mar 1, 2012 6:30 PM, "Enric Caumons" < reply@reply.github.com> wrote:

I have just done a commit which includes new functionality. I also have had a look at the issue you describe and included the fix in the commit. In search() method I was using boolean count instead of Boolean count; where Boolean is seralizable and boolean is not. Notice that all parameters that I am sending to OpenERP are serialized except this, so I think this should solve the problem. Please tell me if this works. Cheers!


Reply to this email directly or view it on GitHub:

https://github.com/zikzakmedia/android-openerp/issues/1#issuecomment-4256491

caumons commented 12 years ago

I do not understand you. What do dou mean with "I saw null parameter in OpenErpConnect.java"? Where? Have you done a pull and tried the new version? You should call the method with true or false values for count, not null.

If you are referring to line 169, this is the context and I am passing null as we are not actually using it.

If you are still getting errors, please provide more info, stacktrace... in order to find a fix. Else, tellme and I will close this issue.

Go to the file XMLRPCClient.java and put a breakpoint: String faultString = (String) map.get(Tag.FAULT_STRING); int faultCode = (Integer) map.get(Tag.FAULT_CODE); // <== BreakPoint at this line (350)

Now execute the code again with the debugger and copy / paste the value of faultString. With this we will see if the problem comes from the OpenERP response.

Thanks.

kathawut commented 12 years ago

03-05 03:38:44.467: W/System.err(281): java.io.IOException: Cannot serialize null 03-05 03:38:44.487: W/System.err(281): at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:99) 03-05 03:38:44.487: W/System.err(281): at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:72) 03-05 03:38:44.497: W/System.err(281): at org.xmlrpc.android.XMLRPCCommon.serializeParams(XMLRPCCommon.java:37) 03-05 03:38:44.497: W/System.err(281): at org.xmlrpc.android.XMLRPCClient.methodCall(XMLRPCClient.java:254) 03-05 03:38:44.507: W/System.err(281): at org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:171) 03-05 03:38:44.517: W/System.err(281): at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:285) 03-05 03:38:44.517: W/System.err(281): at os.cm.openerp.method.OpenErpConnect.search(OpenErpConnect.java:176) 03-05 03:38:44.527: W/System.err(281): at os.cm.openerp.method.OpenErpConnect.search(OpenErpConnect.java:143) 03-05 03:38:44.537: W/System.err(281): at os.cm.activity.ImageListView.onOptionsItemSelected(ImageListView.java:340) 03-05 03:38:44.537: W/System.err(281): at android.app.Activity.onMenuItemSelected(Activity.java:2195) 03-05 03:38:44.547: W/System.err(281): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730) 03-05 03:38:44.547: W/System.err(281): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143) 03-05 03:38:44.557: W/System.err(281): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) 03-05 03:38:44.567: W/System.err(281): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532) 03-05 03:38:44.567: W/System.err(281): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122) 03-05 03:38:44.577: W/System.err(281): at android.view.View$PerformClick.run(View.java:8816) 03-05 03:38:44.587: W/System.err(281): at android.os.Handler.handleCallback(Handler.java:587) 03-05 03:38:44.587: W/System.err(281): at android.os.Handler.dispatchMessage(Handler.java:92) 03-05 03:38:44.597: W/System.err(281): at android.os.Looper.loop(Looper.java:123) 03-05 03:38:44.607: W/System.err(281): at android.app.ActivityThread.main(ActivityThread.java:4627) 03-05 03:38:44.607: W/System.err(281): at java.lang.reflect.Method.invokeNative(Native Method) 03-05 03:38:44.617: W/System.err(281): at java.lang.reflect.Method.invoke(Method.java:521) 03-05 03:38:44.627: W/System.err(281): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 03-05 03:38:44.627: W/System.err(281): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 03-05 03:38:44.637: W/System.err(281): at dalvik.system.NativeStart.main(Native Method) 03-05 03:38:44.637: D/OpenErpConnect(281): org.xmlrpc.android.XMLRPCException: java.io.IOException: Cannot serialize null 03-05 03:38:44.637: I/------------------ LOGIN FAILED 1(281): java.lang.NullPointerException

still error Long[] task_detail_img_ids = oc.search("task.detail.img",true, new Object[0]); it's not go to this line "int faultCode = (Integer) map.get(Tag.FAULT_CODE); // <== BreakPoint at this line (350) " it's error here "iXMLRPCSerializer.serialize(serializer, params[i]);" in XMLRPCCommon.java line(37) my data that I set in to params is [[CM_ANDROID, 1, 1, task.detail.img, search, [Ljava.lang.Object;@44f3abb0, 0, 0, null, null, false]]
params is [CM_ANDROID, 1, 1, task.detail.img, search, [Ljava.lang.Object;@44f3abb0, 0, 0, null, null, false]

Thanks.

caumons commented 12 years ago

Your problem is curious. I am using the connector in an Android app and I am not experiencing this issue...

Have you created the OpenErpConnect instance through the static connect() method with the right connection data?

Before reporting this issue, have you used the debuger to see exactly which parameter is null and is causing the failure? Without this information I can not help you, as I only see the stacktrace of a null serialization failure...

In your code I see that you are using CM_ANDROID. What is this? Is it a string? If you are using connect() to create the instance this value should be a string literal here.

I also see that you are using 1 value for your user id and pass, I guess these values are correct for you.

Also be sure "task.detail.img" is actually a table in OpenERP to which you can access from Web Services.

And finally, test it with other tables, e.g. res.partner.contact and try to use other search conditions.

Cheers.

caumons commented 12 years ago

I have just closed the issue and set it to declined as no more feedback has been provided and I have not been able to reproduce it. This connector is used to synchronize over 125.000 records from an OpenERP server without problems... So I guess your problem is a misuse. Cheers!

kathawut commented 12 years ago

Yep I 'll test it. Thank you. On 4/4/2012 6:07 PM, Enric Caumons wrote:

I have just closed the issue and set it to declined as no more feedback has been provided and I have not been able to reproduce it. This connector is used to synchronize over 125.000 records from an OpenERP server without problems... So I guess your problem is a misuse. Cheers!


Reply to this email directly or view it on GitHub: https://github.com/zikzakmedia/android-openerp/issues/1#issuecomment-4951228

caumons commented 12 years ago

Hi! Pull the latest commit and read the updated doc, I think your issue is because you are trying to connect to "localhost" instead the real IP in which your OpenERP is running. (Read issue #2 for more info).

kathawut commented 11 years ago

Hi there,

Kathawut Kumpor wants you to try Dropbox! Dropbox lets you bring all your photos, docs and videos with you anywhere and share them easily.

Get started here. http://www.dropbox.com/el/?r=/referrals/NjI5ODUzMDQwNTc%3Feh%3DAADwk4rpaaNHO3a05YwhRKmlfCKiCHKF6OUEynAo5YhEgA&b=clk:None:17458540911954302994:1262:635&z=AAArJYkMmPjo5jnAQqv9XQgzauKMgMCq6IfhRQ6VI8AiBg


To stop receiving invites from Dropbox, please go to http://www.dropbox.com/el/?r=/bl/AAAOX542KEbgXo5HY_WdZO_X-sYn8uwYDyTQ9Cyts4cZGg/reply%252Bi-3449644-c18c2635be82e6a7f0d569802c0a5173763cd43b-675592%2540reply.github.com&b=clk:None:17458540911954302994:1262:635&z=AADvlvxWpECkDXHnRX2snv3kwxLqXDNCIXrV61zOnZTieg Dropbox, Inc., PO Box 77767, San Francisco, CA 94107