Posted by sisko on March 11, 2011 at 5:37pm
Hi guys,
I really need help.
I recently installed the Services Module and whilst I understand it is very powerful, I could not figureout how to set up any service.
I am in the final stages of developing an Android application. It has to connect to my Drupal site to upload data which will be saved as nodes or update existing nodes.
So for this process, I need the service module up, running and responding.
I need step-by-step and simple instructions please.
Comments
The documentation has a lot
The documentation has a lot of good materials, including examples and tutorials:
http://drupal.org/documentation/modules/services
More specific info probably depends on what protocol you want to use. I don't have any specific experience with Android.
Good luck,
Micah
Thanks for responding Micah
I have visited the link you provided many times over the last 3/4 days.
This may sound very stupid but the information at that link hasn't helped me.
Where I am really struggling is in actually setting up a service and what pattern the URL needs to be in to access said service.
For instance, I am interested in node.save. After the module is activated and I perform some test at the services page, then what?
Thinking the service will perhaps just work at this stage, I tried playing around with different arguments at the end of my URL. No Joy!
All I typically get is an "Access Denied" message even as the administrator.
I was expecting to see some what to configure, save and see the URL pattern for each desired service but that doesn't happen.
Or, do I actually have to create a custom module for each service I am interested in???
Any help you can give me with be dearly appreciated!.
Thanks.
It's not stupid - it takes a
It's not stupid - it takes a while to get your hands around the services module.
First, you do not have to create custom modules, unless you need functionality beyond what is provided with the services module, which doesn't seem to be the case.
Second, the URL you access is a fixed one, depending on the protocol (or services server) you use. I've only used amfphp, for which the url to access would be: www.example.com/services/amfphp. If you look at the xmlrpc example in http://drupal.org/node/816934, you'll see that the url is www.example.com/services/xmlrpc (I haven't tried this example, though). AFAIK, method call parameters are not passed through the URL.
So you really need to decide which protocol to use and then make sure you install and enable the appropriate server. For example, the amfphp services server does not come with the services module - it's a separate module. I use it because my app is a Flex app. One of the best tutorials on accessing services from Felx/Flash is http://electricpineapple.net/2009/03/10/api-keys-to-the-city-setting-up-... (check out the comments too - there are some helpful tips there).
In what language are you developing you client app? And do you know what protocol you want to use to communicate with Drupal?
Best,
Micah
Thanks Micah
I appreciate the encouraging comments.
As I am just beginning with Services, I would opt to use the XMLRPC server since it is provided with the Services module.
I click the XMLRPC link (http://testsite.com/services/xmlrpc) for my site and get the following message on a blank page:
XML-RPC server accepts POST requests only.That was my first clue I somehow have to POST information rather than using the URL.
Secondly,
The client is a Java application. Specifically, it is an Android App.
I am struggling at finding the request send algorithm for Java and the response configuration for the server.
Hey, thanks for your continued assistance.
A Google search for "drupal
A Google search for "drupal services android" brought some interesting results, including:
http://groups.drupal.org/node/70903
That might give you a push in the right direction.
(in general, these days Google is a developer's best friend :)
Good luck,
Micah
Which version of Drupal?
Which version of Drupal are you working with? I have been able to successfully implement a Java client that accesses Drupal web services from a Drupal 6 installation. I'm still working through the kinks in Drupal 7. I'm using an XMLRPC client library. There is currently a light weight XMLRPC library for Android also. This link may help you. http://code.google.com/p/android-xmlrpc/
Thanks for your response. I
Thanks for your response.
I am also working with XMLRPC on Drupal 6.
My troubles are seemingly without end. I finally gave up trying to use Services and instead just implemented a PHP bridge which reads the $_GET data from the URL. My Android app sends all its data in an HTTP GET URL format. Then in the PHP script bridging my app with my website, I write code to execute whatever I need according to the supplied arguments.
So far this is kinda working but I would really appreciate your help in getting Services to do the heavy lifting for me so I don't have to write so much code.
One primary problem is: How do I discover the format for sending data to services from JAVA?
Using Services pre-view is OK but not without it's challenges when it come to figuring out how to format the data input.
Out side of the pre-view, in JAVA and PHP for example, it is much much worse.
Thanks agains
Have you guys read
Have you guys read this?
http://groups.drupal.org/node/25856
Old, but perhaps still relevant.