I want to use OkHttp3
library to connect with Odoo v9 server
for my Android
application. There's odoo-rpc-v3 already available which internally uses android Volly library
and sometimes throws NullPointerException
with no error messages
which is out of my control & crashes the application. Here's the Odoo v9 Web Services API Docs which is wriiten using Apache XML-RPC library in Java. I want execute same call using of OkHttp3 library.
The Calls are:
1. Logging in
final XmlRpcClient client = new XmlRpcClient();
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()
)
);
2. Calling methods
final XmlRpcClient models = new XmlRpcClient() {{
setConfig(new XmlRpcClientConfigImpl() {{
setServerURL(new URL(String.format("%s/xmlrpc/2/object", url)));
}});
}};
models.execute("execute_kw", asList(
db, uid, password,
"res.partner", "check_access_rights",
asList("read"),
new HashMap() {{ put("raise_exception", false); }}
));
Ultimately I want to use XML-RPC using OkHttp3. Any suggestions, guidelines or help are welcome. Thanks in advance.