java - Android XML-RPC Error -


I call this XML-RPC method from Android (http://foxrate.org/) using these libraries

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); } Hold (XMLRPCException e) {// TODO self generated blocking block e.printStackTrace (); }   

This generates a true XML call, but the server returns the HTTP error code 301. It works fine when I try to do it with Firefox with the POSTER plug-in. The HTTP 301 status code means the server wants to forward it to another URL.

In this case, he wants to remove "www" and redirect to foxrate.org/rpc.

If you want to follow this redirect to an XMLRC client (this is not in its default mode), then this first line of your code should look like this:

 < Code> XMLRPCClient client = new XMLRPCClient (new URL ("http://www.foxrate.org/rpc/"), FLAGS_FORWARD);   

You will get more flags - something else happens in the case (such as invalid SSL certificate;)).

Of course, you can also use it as a direct URL, but it will be very easy :) (And they can change it later on any other redirect.)

Comments