开发者

Just cant integrate DRUPAL and ANDROID

I am using Drupal to create a web service for my android application. I have basic understanding of Drupal like enabling modules , themes , configuring them ; But this "Services" module is the one which I can not get in head. I downloaded services 6.2 and enabled services module and node services module

Now when I navigate to site building -> services -> node.get I get a form in which I can enter the node id and fields and this is working fine.

But I don't know how to get the开发者_JS百科 response from android. I have not yet enabled xmlRPC server. I have enabled the anonymous user to visit the services page so that I don't need to get authentication or session id.

Basically I just want to see the response in my log cat in eclipse sdk for just node 1 and I will be set to go from that point.


Services module allow using remote protocols (xmlrpc, soap, rest, etc) to communicate third-party app with Drupal.

To use it, you need to define at least one endpoint. Setup name, protocol, allowed resources (nodes, users, files, comments, etc).

For example, define xmlrpc endpoint. Then you can call it from xmlrpc client on Android.

xml-rpc exposes a set of remote methods, the most interesting are:

  • user.login - logs in user, it takes username and password as arguments
  • user.logout - logout

Node CRUD operations:

  • node.retrieve - retrieve
  • node.create - create a new node
  • node.update - update existing node
  • node.delete - delete node
  • node.index - get list of nodes

The same CRUD methods exists for other Drupal objects (files, comments, users, taxonomy_terms), only replace "node" to object name. For example: "file.create" - create file, "file.index" - retrieve list of files, and etc

If you need to authorize, you need to call "user.login" first, and if call is succeeded, store sessid and session_name values of returned method structure.

Then send value

session_name+"="+sessid

as cookie in all subsequent calls to identify the session. Also, you must enable "session authentication" checkbox in Drupal service endpoint configuration. Without it, all requests to endpoint will be executed as anonymous user.

To make your own xmlrpc service, you need to define hook_xmlrpc in your module, and expose a set of methods.


See the Services documentation at http://drupal.org/node/783722 and http://drupal.org/node/790416 for some examples to get you started. I find these give a good introduction on how to setup and use the Services module.


I'm not sure if this is what you are looking for, but you could use an HttpClient to access your service. See this answer for more help. Since I am not a Drupal expert, I'm not sure if you need to enable or disable xmlRPC since you have enabled these "Service" modules. With a little research (here) I did find some useful information that basically says enable xmlRPC on Drupal and import an XML-RPC client into your Android application to begin using it.


The question has been answered but I am adding what I found to be an excellent Video tutorial to integrate Drupal site with Android App.

http://www.youtube.com/watch?v=ezk_21sfEQM

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜