// Detect response type requested. switch ($response) { case 'json': Kit::ClassLoader('RestJson'); $rest = new RestJson($db, $user, $_REQUEST); break; case 'xml': Kit::ClassLoader('RestXml'); $rest = new RestXml($db, $user, $_REQUEST); break; default: $serviceResponse->ErrorServerError('Unknown response type'); } // Run the method requested. if (method_exists($rest, $method)) { $serviceResponse->Success($rest->{$method}()); } else { $serviceResponse->ErrorServerError('Unknown Method'); } break; default: $serviceResponse->ErrorServerError('Not implemented.'); } exit; } // No method therefore output the XMDS landing page / document ?> <html> <head> <title>Xmds</title> </head>