Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
15980 มุมมอง

I want to connect my android app to our odoo installed on the server. i've added XML-RPC libraries like this:

compile files('libs/xmlrpc-client-3.1.jar')
compile files('libs/xmlrpc-common-3.1.jar')


this is the button click listener which should be config and login into our odoo.

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {

final XmlRpcClient client = new XmlRpcClient();

final XmlRpcClientConfigImpl start_config = new XmlRpcClientConfigImpl();
start_config.setServerURL(new URL(url));
final Map<String, String> info = (Map<String, String>) client.execute(
start_config, "start", emptyList());

final String url = info.get("host"),
db = info.get("database"),
username = info.get("user"),
password = info.get("password");


final XmlRpcClientConfigImpl common_config = new XmlRpcClientConfigImpl();
common_config.setServerURL(
new URL(String.format("%s/xmlrpc/2/common", url)));
client.execute(common_config, "version", emptyList());


int uid = (int)client.execute(
common_config, "authenticate", asList(
db, username, password, emptyMap()));


}
catch (IOException e){
Toast.makeText(MainActivity.this,e.toString(),Toast.LENGTH_LONG).show();
} catch (XmlRpcException e) {
e.printStackTrace();
}


}

but error accourd when the debugger reach the  final XmlRpcClient client = new XmlRpcClient(); the app crashes and this is the output: 










E/AndroidRuntime: FATAL EXCEPTION: main

                                                                                      Process: com.mortezaaghili.odooapiintegration, PID: 18991

                                                                                      java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/ws/commons/serialize/DOMSerializer;

                                                                                          at org.apache.xmlrpc.serializer.NodeSerializer.<clinit>(NodeSerializer.java:27)

                                                                                          at org.apache.xmlrpc.common.TypeFactoryImpl.<clinit>(TypeFactoryImpl.java:85)

                                                                                          at org.apache.xmlrpc.common.XmlRpcController.<init>(XmlRpcController.java:28)

                                                                                          at org.apache.xmlrpc.client.XmlRpcClient.<init>(XmlRpcClient.java:50)

                                                                                          at com.mortezaaghili.odooapiintegration.MainActivity$1.onClick(MainActivity.java:39)

                                                                                          at android.view.View.performClick(View.java:5637)

                                                                                          at android.view.View$PerformClick.run(View.java:22429)

                                                                                          at android.os.Handler.handleCallback(Handler.java:751)

                                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)

                                                                                          at android.os.Looper.loop(Looper.java:154)




อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Maybe you could use this https://github.com/DeBortoliWines/openerp-java-api or get inspiration form the code.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, did you solve your error. I have the same :(

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 15
3121
3
ม.ค. 19
7575
2
ส.ค. 17
13689
0
ส.ค. 16
4837
0
พ.ค. 16
6949