Xml remote procedure calls on android
Using web services on android phones, is pretty simple. For most popular services, there is a usable library available.
Here is a little snippet for using an android library, called android-xmlrpc.
It's very small, a jar made of it's source is just 17 KByte in size.
Documentation is virtually non existent, or very bad. The whole topic is badly underdocumented.
For the past week, I have used trial-and-error tactics to find out what xml methods joomla, and other portal engines use. FYI they don't follow the official documentation.
- private XMLRPCClient mXMLRPCClient = new XMLRPCClient("web adress, the XML-RPC entry point");
- /**
- * Do an xmlrpc call
- *
- * @param method method name
- * @param values username/password etc
- * @return object[] unparsed!
- */
- // prepare variables
- // generally, there are two kind of methods available, one with added values, one without.
- if (values == null) {
- try {
- return results;
- } catch (XMLRPCException e) {
- }
- } else {
- // do call
- try {
- return results;
- } catch (XMLRPCException e) {
- //TODO
- }
- }
- }
- //usage:
- //
- //String method = "mt.getCategoryList";
- //Object[] toParse = (Object[]) getValue(method, new Object[]{"username","password"});
- //
- //
The received object could contain a lot of item types. Maybe it's a list, maybe it's just one item.
Here is an example, for parsing the received object(if it's just one item):
- /**
- * Get post
- *
- * @param values[] String postid String username String password
- *
- */
- if (map.get("userid") != null) {
- }
- }
For more info read these pages:
http://www.xmlrpc.com/
http://www.sixapart.com/developers/xmlrpc/





Comments
A detailed tutorials like
A detailed tutorials like this one is what I need cause I'm really clueless about the remote procedure calls. I'm glad you make this kind of discussion.Anthony Cole
Remote Processes
Wow, thanks. I just got an Android device for reading that also has wifi, this information may come in handy to me and millions of others. I hope to read more from you in the future.