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)