test.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. exit;
  3. require_once '../inc/global.inc.php';
  4. require_once '../inc/lib/nusoap/nusoap.php';
  5. require_once '../inc/conf/configuration.php';
  6. ?>
  7. <html>
  8. <body>
  9. <div class="results">
  10. <?php
  11. $server = api_get_path(WEB_CODE_PATH).'webservices/';
  12. $serversys = api_get_path(SYS_CODE_PATH).'webservices/';
  13. //$script = 'registration.soap.php';
  14. $script = isset($_POST['script']) ? $_POST['script'] : false;
  15. $function = isset($_POST['function']) ? $_POST['function'] : false;
  16. $contact= $server.$script.'?wsdl';
  17. $client = new nusoap_client($contact);
  18. $err = $client->getError();
  19. if ($err) {
  20. // Display the error
  21. echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
  22. // At this point, you know the call that follows will fail
  23. }
  24. $response = array();
  25. if (!empty($function)) {
  26. $response = $client->call($function);
  27. echo '<pre>';
  28. print_r($response);
  29. echo '#</pre>';
  30. } else {
  31. echo "empty function $function";
  32. }
  33. $list = scandir($serversys);
  34. $scripts = array();
  35. foreach ($list as $item) {
  36. if (substr($item,0,1) == '.') { continue; }
  37. if (substr($item,-8)=='soap.php') {
  38. $scripts[] = $item;
  39. }
  40. }
  41. ?>
  42. </div>
  43. <form method="POST" action="">
  44. <label for="script">Script</label>
  45. <select name="script">
  46. <?php
  47. foreach ($scripts as $script) {
  48. echo '<option value="'.$script.'">'.$script.'</script>';
  49. }
  50. ?>
  51. </select><br />
  52. <label for="function">Function</label>
  53. <input type="text" name="function" value="<?php echo $function;?>"></input><br />
  54. <label for="param[0]">Param 0</label>
  55. <input type="text" name="param[0]" ></input><br />
  56. <input type="submit" name="submit" value="Send"/>
  57. </form>