soap.test.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. global $_configuration;
  14. // First build the signature to use with the webservice. We assume
  15. // we are calling the webservice from the same server, so getting
  16. // the IP (part of the signature) can be done through $_SERVER['REMOTE_ADDR']
  17. $ip = trim($_SERVER['REMOTE_ADDR']);
  18. $signature = sha1($ip.$_configuration['security_key']);
  19. // Prepare the arguments to the webservice, based on the user ID (int), the course ID (int), the learnpath_id and the learnpath_item_id:
  20. $uid = 1; // set to your user ID
  21. $cid = 1; // set to your course ID
  22. $lpid = 1; // set to your learnpath ID
  23. $lpiid = 1; // set to your learnpath item ID
  24. // Build the server's SOAP script address
  25. $server = api_get_path(WEB_CODE_PATH).'webservices/soap.php?wsdl';
  26. /**
  27. * Call the webservice
  28. */
  29. // Init the SOAP connection
  30. $client = new SoapClient($server, array('cache_wsdl' => WSDL_CACHE_NONE));
  31. // Call the function we want with the right params...
  32. $response = $client->{'WSReport.test'}();
  33. //$response = $client->{'WSReport.GetLearnpathStatusSingleItem'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid, $lpiid);
  34. //$response = $client->{'WSReport.GetLearnpathProgress'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid);
  35. //$response = $client->{'WSReport.GetLearnpathHighestLessonLocation'}($signature, 'chamilo_user_id', $uid, 'chamilo_course_id', $cid, $lpid);
  36. // Print the output, or do whatever you like with it (it's the status for this item):
  37. echo '<pre>'.$response.'</pre>';
  38. // This should print "complete", "incomplete" or any other active status.