# Example server usage

1. <?php
2. /**
3. * Example Web Services
4. *
5. * Example structure for a more complex web service
6. * that can support multiple endpoints and service types:
7. * /path/to/plugin/
8. * webservices/
9. * TYPE/ (EG: rest)
10. * ENDPOINTNAME.php (EG: user.php)
11. * model/
12. * response/ (Store response classes here)
13. * service/ (Store service classes here)
14. *
15. * @author Mark Nielsen
16. * @package blocks/helloworld
17. ***/
19. define('NO_DEBUG_DISPLAY', true);
20. define('NO_MOODLE_COOKIES', true);
22. require_once('../../config.php');
23. require($CFG->dirroot.'/local/mr/bootstrap.php');
24. require($CFG->dirroot.'/blocks/helloworld/lib/server/service.php');
25. require($CFG->dirroot.'/blocks/helloworld/lib/server/response.php');
27. // Server validation (Mix and match)
28. $validator = new Zend_Validate();
29. $validator->addValidator(new mr_server_validate_secure())
30. ->addValidator(new mr_server_validate_method())
31. ->addValidator(new mr_server_validate_ip('127.0.0.1'))
32. ->addValidator(new mr_server_validate_token('tokenvalue'))
33. ->addValidator(new mr_server_validate_login());
35. $server = new mr_server_rest('blocks_helloworld_lib_server_service', 'blocks_helloworld_lib_server_response', $validator);
36. $server->handle();

Documentation generated on Thu, 28 Jun 2012 16:33:51 -0700 by phpDocumentor 1.4.3