如何在xmlrpc(openerp)android中发送搜索请求

时间:2015-01-23 09:55:52

标签: android

我正在编写用于调用搜索功能的代码:

Object[] paramsObj = new Object[1];
paramsObj[0] = new Object[] {"surveyor", "=", s.mUserId};
Long[] ids = s.search("atm.surverys.management", paramsObj);

但我收到的错误是这样的:

01-23 08:10:18.422: W/System.err(2845): java.io.IOException: Cannot serialize null
01-23 08:10:18.432: W/System.err(2845):     at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:99)
01-23 08:10:18.432: W/System.err(2845):     at org.xmlrpc.android.XMLRPCSerializer.serialize(XMLRPCSerializer.java:61)
01-23 08:10:18.442: W/System.err(2845):     at org.xmlrpc.android.XMLRPCCommon.serializeParams(XMLRPCCommon.java:36)
01-23 08:10:18.452: W/System.err(2845):     at org.xmlrpc.android.XMLRPCClient.methodCall(XMLRPCClient.java:250)
01-23 08:10:18.452: W/System.err(2845):     at org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:170)
01-23 08:10:18.462: W/System.err(2845):     at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:281)
01-23 08:10:18.472: W/System.err(2845):     at com.example.transtech1.OpenErpConnect.search(OpenErpConnect.java:180)
01-23 08:10:18.483: W/System.err(2845):     at com.example.transtech1.OpenErpConnect.search(OpenErpConnect.java:143)
01-23 08:10:18.483: W/System.err(2845):     at com.example.transtech1.MainActivity$1$1.doInBackground(MainActivity.java:64)
01-23 08:10:18.502: W/System.err(2845):     at com.example.transtech1.MainActivity$1$1.doInBackground(MainActivity.java:1)
01-23 08:10:18.502: W/System.err(2845):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-23 08:10:18.512: W/System.err(2845):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
01-23 08:10:18.522: W/System.err(2845):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-23 08:10:18.522: W/System.err(2845):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
01-23 08:10:18.543: W/System.err(2845):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
01-23 08:10:18.543: W/System.err(2845):     at java.lang.Thread.run(Thread.java:856)
01-23 08:10:18.552: D/OpenErpConnect(2845): org.xmlrpc.android.XMLRPCException: java.io.IOException: Cannot serialize null

1 个答案:

答案 0 :(得分:0)

您使用的连接器显然是为OpenERP 6.0设计的 如果您使用的是更新版本的OpenERP,那么您应该查看zahidj为响应Issue #4 in the android-openerp GitHub repository而编写的newsearch方法。

调用newsearch方法而不是连接到OpenERP 7.0和Odoo 8.0服务器的搜索方法时,不会引发“无法序列化null”错误。