I’m trying to call this XML-RPC Method from Android(http://foxrate.org/) using this libraries https://github.com/timroes/aXMLRPC
The call code is:
XMLRPCClient client = new XMLRPCClient(new URL("http://www.foxrate.org/rpc/"));
try {
Object o = client.call("foxrate.currencyConvert", "USD","GBP",(double)1);
} catch (XMLRPCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
It generates a correct XML call, but the server returns Http error code 301.
When I try to do this call from firefox with POSTER plug-in it works fine.
The HTTP 301 status code means, that the server wants to forward to another URL.
In this case it wants to take away the “www” and redirects to foxrate.org/rpc.
If you want the aXMLRPC client to follow this redirects (what it doesn’t in its default mode), use the
FLAGS_FORWARDflag. The first line of your code should look like this:You will find more flags — for the case something else happens (like invalid SSL certificates ;)) — in the documentation.
Of course, you could also use http://foxrate.org/rpc directly as URL, but that would be too simple 🙂 (And they might change it later to some other redirect.)