test.php 1.6 KB

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