Services 3.x and Drupal 7

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

Our company is planning to use the services with drupal to integrate with our other services.

I have done some work with 6-2x and was able to implement and test a client for our purposes using xmlrpc.

We would like to go with 7x I was doing some testing with the services module and 7x, using curl and no matter what I do, I get 404s which bring back the html text of the page, rather than an appropriate response. I have tried curl with the rest and an xmlrpc client testing tool with the xmlrpc

Comments

What method are you

IncrediblyKenzi's picture

What method are you calling?

Some context on where you're seeing the problem may help. Is this a node resource call? I assume you created a new endpoint and assigned permissions accordingly on it?

-=Aaron

I got past the first issue At

cjnoyescrisp's picture

I got past the first issue

At one point while setting up endpoints, the ui seemed to require a full url which didn't make sense. I removed that

Now I am seeing 404 Not Found: Could not find resource ...
try any one.

for instance

curl -v --data-ascii text=something http://drupal.my.mlogic.be/rest/unauthenticated/system/connect
* About to connect() to drupal.my.mlogic.be port 80 (#0)
* Trying 127.0.0.1... connected
* Connected to drupal.my.mlogic.be (127.0.0.1) port 80 (#0)

POST /rest/unauthenticated/system/connect HTTP/1.1
User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) libcurl/7.20.1 NSS/3.12.8.0 zlib/1.2.3 libidn/1.16 libssh2/1.2.4
Host: drupal.my.mlogic.be
Accept: /
Content-Length: 14
Content-Type: application/x-www-form-urlencoded

  • HTTP 1.0, assume close after body
    < HTTP/1.0 404 Not found: Could not find resource system
    < Date: Mon, 07 Mar 2011 21:54:12 GMT
    < Server: Apache/2.2.17 (Fedora)
    < X-Powered-By: PHP/5.3.4
    < Expires: Sun, 19 Nov 1978 05:00:00 GMT
    < Last-Modified: Mon, 07 Mar 2011 21:54:12 +0000
    < Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
    < ETag: "1299534852"
    < Vary: Accept
    < Content-Length: 0
    < Connection: close
    < Content-Type: text/html; charset=UTF-8
    <
  • Closing connection #0

I noticed this in the code

function _services_build_resources($endpoint_name = '') {
module_load_include('resource_runtime.inc', 'services');

there is no file resource_runtime.inc in the services module

Dear Christopher, Please make

ygerasimov's picture

Dear Christopher,

Please make sure you have enabled system resource and connect action in your services endpoint. 7.x version is quite stable and covered with tests. If you have difficulties with calling some methods please check the tests to see how everything is called.

Regarding system connect, in 7.x you can call user.login action without calling system.connect before.

Let me know if you still have difficulties with it.

in rest_server.module the

cjnoyescrisp's picture

in rest_server.module the following lines are giving fatals from no method, I see this being fixed in git

drupal_add_http_header('HTTP/1.0 401 Unauthorized', $e->getMessage());

I have had experience with 6.x and I gave the necessary permissions

I am seeing persistent can't find resource i.e. for any resource type

I think the module_load_include is a problem below as I don't see the file it's trying to include
function _services_build_resources($endpoint_name = '') {
module_load_include('resource_runtime.inc', 'services');

I notice sessauth is going away as well as keyauth which was in 6.x, the reliance on oauth is going to be a problem because our intent is to do server to server communications

I would encourage your group to add integration and/or round trip testcases. I.e. a cases where the test invokes a service, I only see test cases for the ui.

I think the best is to use

ygerasimov's picture

I think the best is to use 7.x version from git. The tests for resources and actions are placed in folder tests/functional

Updating a user picture using the XMLRPC service.

larrylee's picture

I'm tring to update a user picture using an XMLRPC service.

It appears that the user.update function accepts two arguments, an int named uid that represents a user id, and a struct named data.

It appears that data must contain a string named current_pass that represents the login password.

I tried adding a struct value named picture to data. My picture struct has three string values, fid, uri, and status.

I also added a string value named mail to data.

When I called user.update, it updated the user's email address but ignored my picture update. What am I doing wrong?

Services

Group organizers

Group categories

Group notifications

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