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