Confusion with URI needed for a new service module

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
j. ayen green's picture

I created a module that uses hook_service to define a service, name=service.stuff, which does then appear in the service list in the services settings pane.

I'm confused about how to invoke it for testing on a closed system (i.e no incoming traffic). I tried hitting it with the uri services/service.stuff and also services/module_name/service.stuff, both of which gave me Page not found.

Comments

First of all, do you see it

shushu's picture

First of all, do you see it in the browsing - http://example.com/admin/build/services/browse ?

Yes, sorry, that was the

j. ayen green's picture

Yes, sorry, that was the 'pane' I was referring to. It's listed.

Well, it depends on which

shushu's picture

Well, it depends on which server do you use - in case it is xmlrpc, I guess the URL should be http://example.com/xmlrpc.php
Which client do you try to use vs the server ?
Regarding to the method itself, it just need to be service.stuff

Ok, this seems then to be

j. ayen green's picture

Ok, this seems then to be where I'm lost. I'm wanting my site to be the server and provide the service...and I'm trying to test it as such. Do I need to be running something other than just the service module in order to respond to (whatever is) the uri?

Some more information will

bsenftner's picture

Some more information will really help:

Which version of Drupal are on using?
Which version of Services are you using?
Which Services Server is your service being published (XMLRPC, REST, other..)?
Do you have authentication enabled for your service? If so, what kind?

And to answer your direct question: yes, you need to have enabled the Services Server that your service will be published - as in a REST server, an XMLRPC server, a JSON server and so on...

I'm running D6, and 6.x-2.4

j. ayen green's picture

I'm running D6, and 6.x-2.4 of Services. I have REST enabled, and Keys.

I'm now at the point where if I browse to the service I can enter the arguments for the method and call it and get the correct return. What I'd like to do next is simulate another system calling it, but I get Page not found whether I do it from the browser or from a post action in a form. Though, again, I have little confidence that I'm using the correct uri.

hmmm... My experience is with

bsenftner's picture

hmmm... My experience is with D6, Services 6.x-2.4 and XMLRPC + AMF, and more recently D6 Services 6.x-3.0 REST. With Services 3.0, it's a complete rewrite, so I don't have advice other than have you seen these:

http://drupal.org/node/762088
http://drupal.org/node/400212

The second link above is also the second link in the 1st link's page. On that page, it seems to indicate a url of this form for the REST server:

$request_url = $domain.'/method=user.get&uid=0&hash='.$hash.'&domain_name='.$domain.'&domain_time_stamp='.$timestamp.'&nonce='.$nonce;

does this help? It's very different in 3.0; in 3.0 you define the end-point (url) in your services hook directly.

Still no joy. So, my method

j. ayen green's picture

Still no joy. So, my method is mymethod.myaction, and the module callback is mymodule. Using the services example, I was trying

domain.com/services/mymodule

and now, I'm assuming that since the enabled server is REST that it automatically intercedes? and so based on the above links I tried

domain.com/method=mymethod.myaction

both result in page not found, trying it using curl from a php file and a form with method=post from a html file.

I personally do not have this

bsenftner's picture

I personally do not have this book, but from this link to the start of Chapter 2, it looks like it has the info you seek:
http://my.safaribooksonline.com/book/-/9781849510981/consuming-web-servi...

I remember skipping the book because I was working in Services 3.0 when that released, and the author stated it references the Services 2.x interfaces.

Good luck! Debugging blind sucks.

I'm actually in the process

j. ayen green's picture

I'm actually in the process of reviewing that book, and while one of its other chapters does have an example of creating a REST service on top of Services, it never gets to invoking it from outside the site :( Maybe there will be something further into it.

Guys can you help, please ?

sisko's picture

I am using Services 6.x-2.4 on a Drupal 6 installation. I am trying to use the REST server.

I find the test REST link returns a completely blank page unlike the XMLRPC test link.
I:E http://test2.site.com/services/rest returns nothing.

I experimented with node.get and got back the expected results but aside from the test link not showing any sign of life, I also need to know what format for PHP and JAVA code to use in accessing the REST server interface.

I hope that makes scence to someone who can help me.

Thanks.

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week