client_round2.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Round 2 Interop Client Tests</title>
  5. </head>
  6. <body>
  7. <a href="index.php">Back to Interop Index</a><br>
  8. <p>&nbsp;</p>
  9. <?php
  10. require_once 'client_round2_interop.php';
  11. $iop = new Interop_Client();
  12. function endpointList($test,$sel_endpoint)
  13. {
  14. global $iop;
  15. $iop->getEndpoints($test);
  16. echo "<select name='endpoint'>\n";
  17. echo "<option value=''>-- All Endpoints --</option>\n";
  18. foreach ($iop->endpoints as $epname => $epinfo) {
  19. $selected = '';
  20. if ($sel_endpoint == $epname) $selected = ' SELECTED';
  21. echo "<option value='$epname'$selected>$epname</option>\n";
  22. }
  23. echo "</select>\n";
  24. }
  25. function methodList($test,$sel_method)
  26. {
  27. global $iop;
  28. global $soap_tests;
  29. echo "<select name='method'>\n";
  30. echo "<option value='ALL'>-- Run All Methods --</option>\n";
  31. $prev_method = "";
  32. foreach ($soap_tests[$test] as $x) {
  33. $method = $x->test_name;
  34. if ($method != $prev_method) {
  35. $prev_method = $method;
  36. $selected = '';
  37. if ($sel_method == $method) $selected = ' SELECTED';
  38. echo "<option value='$method'$selected>$method</option>\n";
  39. }
  40. }
  41. echo "</select>\n";
  42. }
  43. function endpointTestForm($test, $endpoint, $method, $paramType, $useWSDL)
  44. {
  45. global $PHP_SELF;
  46. if (!$test) $test = 'base';
  47. echo "Round 2 '$test' Selected<br>\n";
  48. echo "Select endpoint and method to run:<br>\n";
  49. echo "<form action='$PHP_SELF' method='post'>\n";
  50. echo "<input type='hidden' name='test' value='$test'>\n";
  51. endpointList($test, $endpoint);
  52. methodList($test, $method);
  53. echo "<select name='paramType'>";
  54. // echo "<option value='all'>-- All --</option>";
  55. echo "<option value='soapval'".($paramType=='soapval'?' selected':'').">soap value</option>";
  56. echo "<option value='php'".($paramType=='php'?' selected':'').">php internal type</option></select>\n";
  57. echo "<select name='useWSDL'>";
  58. // echo "<option value='all'>-- All --</option>";
  59. echo "<option value='0'>go Direct</option>";
  60. echo "<option value='1'".($useWSDL?' selected':'').">use WSDL</option></select>\n";
  61. echo "<input type='submit' value='Go'>\n";
  62. echo "</form><br>\n";
  63. }
  64. function testSelectForm($selected_test = NULL)
  65. {
  66. global $iop, $PHP_SELF;
  67. echo "Select a Round 2 test case to run:<br>\n";
  68. echo "<form action='$PHP_SELF' method='post'>\n";
  69. echo "<select name='test'>\n";
  70. foreach ($iop->tests as $test) {
  71. $selected = '';
  72. if ($selected_test == $test) $selected = ' SELECTED';
  73. echo "<option value='$test'$selected>$test</option>\n";
  74. }
  75. echo "</select>\n";
  76. echo "<input type='submit' value='Go'>\n";
  77. echo "</form><br>\n";
  78. }
  79. testSelectForm($_POST['test']);
  80. endpointTestForm($_POST['test'],$_POST['endpoint'],$_POST['method'],$_POST['paramType'],$_POST['useWSDL']);
  81. if ($_POST['test'] && array_key_exists('endpoint', $_POST) && array_key_exists('method', $_POST)) {
  82. // here we execute the orders
  83. echo "<h2>Calling {$_POST['method']} at {$_POST['endpoint']}</h2>\n";
  84. echo "NOTE: wire's are slightly modified to display better in web browsers.<br>\n";
  85. $iop->currentTest = $_POST['test']; // see $tests above
  86. $iop->paramType = $_POST['paramType']; // 'php' or 'soapval'
  87. $iop->useWSDL = $_POST['useWSDL']; // 1= do wsdl tests
  88. $iop->numServers = 0; // 0 = all
  89. $iop->specificEndpoint = $_POST['endpoint']; // test only this endpoint
  90. $iop->testMethod = $_POST['method']=='ALL'?'':$_POST['method']; // test only this method
  91. $iop->skipEndpointList = array(); // endpoints to skip
  92. $iop->nosave = 0; // 1= disable saving results to database
  93. // debug output
  94. $iop->show = 0;
  95. $iop->debug = 0;
  96. $iop->showFaults = 0; // used in result table output
  97. echo '<pre>';
  98. $iop->doTest(); // run a single set of tests using above options
  99. echo '</pre>';
  100. }
  101. ?>
  102. </body>
  103. </html>