I am trying to use https://code.google.com/p/android-json-rpc/ for android and use https://github.com/RitwikSaikia/jsonrpc on the java server.
I have followed the examples for android-json-rpc client and jsonrpc server setup.
When using android-json-rpc in my Android app I do the following.
JSONRPCClient client = JSONRPCClient.create("http://service/uri",JSONRPCParams.Versions.VERSION_2);
client.setConnectionTimeout(2000);
client.setSoTimeout(2000);
try
{
client.callString("SimpleCalculatorImpl");
double i = client.callDouble("add", 56, 25);
}
catch (JSONRPCException e)
{
e.printStackTrace();
}
For the Java server I have followed the sample at https://github.com/RitwikSaikia/jsonrpc#defining-interfaces and at https://github.com/RitwikSaikia/jsonrpc#hosting-the-service
When I call the method
String string = client.callString("SimpleCalculatorImpl");
It throws a JSONRPCException: Cannot convert result to String which comes from inside the callString method.
Has anyone encountered this error before or know of better a library to use for an Android client to a Java server for JSON?