You are here

function services_server in Services 6.2

Same name and namespace in other branches
  1. 5 services.module \services_server()
  2. 6 services.module \services_server()
  3. 7 services.module \services_server()

Callback for server endpoint.

Parameters

$server_path: Path to this server, as defined in the server's hook_server_info() implementation.

1 string reference to 'services_server'
services_menu in ./services.module
Implementation of hook_menu().

File

./services.module, line 128
Provides a generic but powerful API for exposing web services.

Code

function services_server($server_path = NULL) {

  // Find which module the server is part of
  foreach (module_implements('server_info') as $module) {
    $info = module_invoke($module, 'server_info');
    services_strip_hashes($info);
    if ($info['path'] == $server_path) {

      // call the server
      services_set_server_info($module);
      print module_invoke($module, 'server');

      // Do not let this output
      module_invoke_all('exit');
      exit;
    }
  }

  // return 404 if the server doesn't exist
  drupal_not_found();
}