hook_services_resource is not working EXAMPLE : this is my sample for service resource hook, i'm using drupal 7. I have enabled the services module and ctools module. the end point is working fine, but when i browse the endpoint/commerce_rest/retrieve url is not working

It returns the following exception, exception 'ServicesException' with message 'Could not find resource retrieve.' as following:

/var/www/webui/drupal/sites/all/modules/services/includes/services.runtime.inc:359\nStack trace:\n#0
/var/www/webui/drupal/sites/all/modules/services/servers/rest_server/includes/RESTServer.inc(83): services_error('Could not find ...', 404)\n#1
/var/www/webui/drupal/sites/all/modules/services/servers/rest_server/includes/RESTServer.inc(36): RESTServer-&gt;getController()\n#2
/var/www/webui/drupal/sites/all/modules/services/servers/rest_server/rest_server.module(40): RESTServer-&gt;handle()\n#3 [internal function]: rest_server_server()\n#4
/var/www/webui/drupal/sites/all/modules/services/services.module(218):
 all_user_func('rest_server_ser...')\n#5 
[internal function]: services_endpoint_callback('commerce_rest', 'retrieve')\n#6 
/var/www/webui/drupal/includes/menu.inc(516): call_user_func_array('services_endpoi...', Array)\n#7 
/var/www/webui/drupal/index.php(33): menu_execute_active_handler()\n#8 {main}


And the source code is:

function test_module_services_resources() {

   $resource = array(
      'commerce_rest' =&gt; array(
      'retrieve' =&gt; array(
        'file' =&gt; array('type' =&gt; 'inc', 'module' =&gt; 'search_service'),
        'callback' =&gt; 'test_module_search_service_results',
        'access callback' =&gt; 'search_access_callback',
        'access arguments' =&gt; array('view'),
        'access arguments append' =&gt; TRUE, 
        ),
    )
 )
);
    return $resource;
}


this hook is not invoked, when I browse the url.
You can try:

/**
 * Implements hook_services_resources
 */
function test_module_services_resources() {

  $resources = array();

  $resources['search_results'] = array(
    'index' =&gt; array(
    'callback' =&gt; 'test_module_search_service_results_index',
    'file' =&gt; array(
      'type' =&gt; 'inc',
      'module' =&gt; 'test_module',
      'name' =&gt; 'resources/search_results.resource'
    ),
    'access arguments' =&gt; array('access content'),
    'args' =&gt; array(),
    ),
  );

  return $resources;

}


Ensure the resource callback test_module_search_service_results_index is located in your module subfolder

test_module/resources/search_results.resource.inc


Then try hitting http://www.example.com/api/search_results (using your site services endpoint)