soap.test.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php /* For licensing terms, see /license.txt */
  2. /**
  3. * Test script for soap.php
  4. * @author Yannick Warnier <yannick.warnier@beeznest.com>
  5. * @package chamilo.webservices
  6. */
  7. /**
  8. * Init
  9. */
  10. exit; //remove to enable
  11. // Include the necessary files, assuming this script is located in main/newscorm/ or something like that
  12. //require_once '../inc/global.inc.php';
  13. // First build the signature to use with the webservice. We assume
  14. // we are calling the webservice from the same server, so getting
  15. // the IP (part of the signature) can be done through $_SERVER['REMOTE_ADDR']
  16. $ip = trim($_SERVER['REMOTE_ADDR']);
  17. $signature = sha1($ip.api_get_configuration_value('security_key'));
  18. // Prepare the arguments to the webservice, based on the user ID (int), the course ID (int), the learnpath_id and the learnpath_item_id:
  19. $uid = 1; // set to your user ID
  20. $cid = 1; // set to your course ID
  21. $lpid = 1; // set to your learnpath ID
  22. $lpiid = 1; // set to your learnpath item ID
  23. // Build the server's SOAP script address
  24. $server = api_get_path(WEB_CODE_PATH).'webservices/soap.php?wsdl';
  25. /**
  26. * Call the webservice
  27. */
  28. // Init the SOAP connection
  29. $client = new SoapClient($server, array('cache_wsdl' => WSDL_CACHE_NONE));
  30. // Call the function we want with the right params...
  31. $response = $client->{'WSReport.test'}();
  32. //$response = $client->{'WSReport.GetLearnpathStatusSingleItem'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid, $lpiid);
  33. //$response = $client->{'WSReport.GetLearnpathProgress'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid);
  34. //$response = $client->{'WSReport.GetLearnpathHighestLessonLocation'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid);
  35. // Print the output, or do whatever you like with it (it's the status for this item):
  36. echo '<pre>'.$response.'</pre>';
  37. // This should print "complete", "incomplete" or any other active status.