Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49206

Android, XMLRPC and Drupal authentication

$
0
0

Hello,

I'm pretty new in the Android World and I just finished a website (http://drupal.org/node/777420).

I would like to make an android app out of it.

I've read alot and I'm using the 'Services' module with XMLRPC.

I'm struggling to do a user authentication and I don't understand the 7 arguments it needs.

Here is the Android Java code I'm using:

                final XMLRPCMethod method1 = new XMLRPCMethod("user.login", new XMLRPCMethodCallback() {
                    public void callFinished(Object result) {
                        testResult.setText(result.toString());
                        // returns:  result={user={uid=0, cache=0, hostname=81.243.167.37, session=, roles={1=anonymous user}}, sessid=4da293fe9394029b4e465b01d81c5fd5}
                    }
                });
                XMLRPCMethod method2 = new XMLRPCMethod("system.connect", new XMLRPCMethodCallback() {
                    public void callFinished(Object result) {
                        GlobalDataStore.sessid = (String) ((Map) result).get("sessid");
                        Object[] params = {
                             GlobalDataStore.sessid,GlobalDataStore.user,GlobalDataStore.password
                        };
                        method1.call(params);
                    }
                });
                method2.call();

The error here is:

D/Test    (  488): org.xmlrpc.android.XMLRPCFault: XMLRPC Fault: Missing required arguments. [code 1]

I've looked into documentation and I see that the method user.login needs 7 arguments:

  • string hash (required) : A valid API key.
  • string domain_name (required) : A valid domain for the API key.
  • string domain_time_stamp (required) : Time stamp used to hash key.
  • string nonce (required) : One time use nonce also used hash key.
  • string sessid (required) : A valid sessid.
  • string username (required) : A valid username.
  • string password (required) : A valid password.

I have the last 3 (sessid, username and password), how, where to get the others ?

Thanks!


Viewing all articles
Browse latest Browse all 49206

Trending Articles