Just cant integrate DRUPAL and ANDROID - 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 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

Related

Dialogflow minimal viable product

I am trying to create the bare minimum of a chatbot with dialogflow in an Android app. Initially I do not need the bot to hook into things or have context and entities. I just want it to match questions with answers as good as it can.
I do not come from the web world so this https://dialogflow.com/docs/getting-started/basic-fulfillment-conversation confuses me. The final part of the tutorial is not finished and it leaves me hanging a bit.
As an Android dev I want the app to:
call a rest api with the user text
or possibly:
invoke an SDK and have a local pretrained agent and not involve the internet an all
You can download the Agent but that is just some json files. I found an Dialogflow.SDK but it seems to be related to speech. In the dialog flow console you can 'copy curl':
curl 'https://api.dialogflow.com/v1/query?v=20170712&query=Hi&lang=en&sessionId=xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx' -H 'Authorization:Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'
I want to access the agent like that from multiple instances of an app.
Do you always need a 'fulfillment'?
The guide mentions creating folders on your local machine(in conjunction with fulfillment) are these only used to do a 'deploy' from your local machine to configure the web hook in the cloud? Or are they also used to deploy the entire Agent to the cloud project? (which i can't seem to find any instructions for, unless it's the same as for webhooks?)
gcloud beta functions deploy weatherWebhook --stage-bucket [BUCKET_NAME] --trigger-http
I have read questions with both tags DialogFlow and Android but most of them seem to involve Google Android Assistent which I have no interest in.
You do not need fulfillment. This is primarily for Dialogflow to take advanced actions or to use more complicated logic to handle the response.
You also cannot run Dialogflow processing on your device - all operations take place in the cloud. So you don't need to download the zip file unless you want to make a backup copy of your agent.
The REST interface you're looking for is the one you found. It handles more than speech - the /query endpoint can take a query parameter which contains "Natural language text to be processed."

Create SDK/API using Parse.Com

I got an assignment to write a SDK/API for a mobile app, which will be developed in all 3 platforms(Android/Windows/iOS) by different persons. Since those mobile app developers are outside companies, my company doesn't want to expose any Data Base structure related information to them.
So they wanted me to use Parse.com as back-end. I was playing with Parse.Com last whole week. But following things are still unclear to me. Hope there could be someone who could help
Once I go to create an app on Parse.Com it binds me to a specific
platform so is there a way I could refer data (classes) on one app to
the other ?
Is there any way I could expose only few functions out side (like
GetProductList(), GetOrders()... ) world irrespective of target OS ?
Making an app on Parse.com won't bind you to a specific platform. While in the Parse dashboard, go to settings -> keys to find the keys you need to access your Parse server for whatever platform you are coding. Parse objects are JSON encoded.
You can add javascript functions to your server via Parse's Cloud Code. These functions can be called via multiple languages. Check out the following links to add javascript functions to your server:
https://parse.com/docs/cloud_code_guide
https://parse.com/docs/js_guide

Store data in App Engine datastore from an Android app

I have created an AppEngine connected Android application, and I'm trying to modify it to be able to store some user data on the server. I do not know what's the easiest way to do so, because I want it to be as simple as possible. I just want to store some basic data for every user. This data is: Name, Email, and some other Strings. I have created a form in the android side which will allow the user to type all the requested data, but I do not know how to send this information to the GAE server and store it in the datastore. I guess I will have to use a Servlet and some kind of RPC service to call the methods. I'm really lost because it is my first time doing this. I'm not experienced neither in android nor in web apps. I hope you can help me.
Update
Well, maybe I did not explain myself well. The system I've been asked to build consists on a web service that store your personal login credentials for most common sites (facebook, gmail, etc). Using a chrome extension, you ask the server for the credentials on the website you are navigating, and then the server asks to your phone for authorization. It will ask (do you give me permission to send your credentials to "some user"), and you have to ansewer yes or no and then the server will act in consequence. The point is that you have to store your credentials in the server in some way, maybe from the android app (which is what I was trying) or from somewhere else. I will also need authentication.
Pd: I use java for the server side.
Since you already started with AppEngine connected Android application, it makes sense to continue customizing it: App Engine Data Access: Adding Entities and RPC.
Update:
There are of course many ways to exchange data between client and server. The most simple would be a servlet handling GET and POST requests with some query parameters.
Also, most popoular lately is REST:
Android REST client: http://appfulcrum.com/2010/08/20/android-how-to-call-rest-service-using-asynctask/ (try using GSON instead to parse JSON)
Server: use a REST framework. My personal choice is RESTEasy. An example: http://ankiewsky.blogspot.com/2010/08/resteasy-on-googleappengine-corerest.html
Update 2:
The simplest possible way - making/handlin a simple POST request:
Android client - making POST request with parameters: http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient
Server handling POST (or GET) and extracting parameters: http://www.exampledepot.com/egs/javax.servlet/GetReqParam.html
Find and follow thoroughly the Topic Index on this page. Gud luck

How to connect to the drupal site with xmlrpc from Android?

In the beginning I want to become authorised on a Drupal site, but I cannot connect with "system.connect", as a result I receive null. How can I do that? Thanks in advance.
From all what i know till now you need to have xmlrpc method library first in your project and then you can use xml rpc methods to connect to drupal site call methods and add paramteres
You will probably want to use services, it supports xmlrpc by default while Steps to make a mobile application using drupal as a back end or service deals with REST mainly the setup is virtually the same. You can change the JSON code from there to use the Apache XMLRPC android library.
The text below is related to xmlrpc.
You need to define your endpoint. Setup name, protocol (xmlrpc), allowed resources (nodes, users, comments, files, etc).
And enable "Session authorization" checkbox. Without it, all remote requests will be executed as anonymous user.
To authorize, you call "user.login" method with username and password arguments.
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.

How can Android connect to Drupal service?

I am writing an android program and I need to connect to the Drupal service to fretch the data or submit data. How can I do that?
Thank you very much!!!
I don't have a link available, but I know there was a fairly recent talk about using the Services module to integrate drupal with a mobile application. There is a featured article on the drupal website that discusses this a bit too.
I wrote an article with detailed instructions, about how to integrate Drupal with Android.
For connection to services, you can use xml-rpc.
You need xml-rpc client library for Android (for example, Redstone's lib with my modifications. You can find it at link, given at the end of my article about Drupal-Android integration).
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.
If you need more details, you can find it here:
Drupal with Android integration: make posts and upload photos.
Sorry I don't know anything about Drupal services. But assuming they are a HTTP based services (e.g. REST service), Android uses the Apache HTTP library, see here for the HTTP docs.

Categories

Resources