]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/xmlrpc/xmlrpc-servers.php
add the xmlrpc testsuite (wiki and interop) from xmlrpc-epi
[SourceForge/phpwiki.git] / tests / xmlrpc / xmlrpc-servers.php
1 <?php
2 /**
3   * List of various interop and wiki servers to test against.
4   * interop for the basic library functionality, and then the wiki API.
5   */
6
7 if (empty($GLOBALS['SERVER_NAME'])) {
8     global $HTTP_SERVER_VARS;
9     $GLOBALS['SERVER_NAME'] = $HTTP_SERVER_VARS['SERVER_NAME'];
10     $GLOBALS['SERVER_PORT'] = $HTTP_SERVER_VARS['SERVER_PORT'];
11     $GLOBALS['PHP_SELF'] = $HTTP_SERVER_VARS['SCRIPT_NAME'];
12 }
13
14 function get_user_server() {
15    return
16    array('title' => "user defined",
17          'desc' => "Enter your own server to test against",
18          'args' => null,
19          'host' => $GLOBALS['HTTP_GET_VARS']['user_host'],
20          'uri' => $GLOBALS['HTTP_GET_VARS']['user_uri'],
21          'port' => ($GLOBALS['HTTP_GET_VARS']['user_port'] ? $GLOBALS['HTTP_GET_VARS']['user_port'] : 80),
22          'type' => "user"
23          );
24 }
25
26 function get_wiki_servers($include_user=true) {
27    $list = 
28    array (
29       array('title' => " local ",
30             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/../../RPC2.php",
31             'args' => null,
32             'host' => $GLOBALS['SERVER_NAME'],
33             'uri' => dirname($GLOBALS['PHP_SELF'])."/../../RPC2.php",
34             'port' => $GLOBALS['SERVER_PORT'],
35             "default" => true
36             ),
37       array('title' => "PhpWiki",
38             'info_link' => "http://phpwiki.sourceforge.net/phpwiki/RPC2.php",
39             'args' => null,
40             'host' => "phpwiki.sourceforge.net",
41             'uri' => "/phpwiki/RPC2.PHP",
42             'port' => 80
43             ),
44       array('title' => "PhpWikiDemo",
45             'info_link' => "http://phpwiki.sourceforge.net/demo/RPC2.php",
46             'args' => null,
47             'host' => "phpwiki.sourceforge.net",
48             'uri' => "/demo/RPC2.php",
49             'port' => 80
50             ),
51       );
52
53    if($include_user) {
54       $list[] = get_user_server();
55    }
56
57    return $list;
58 }
59
60 function get_intro_useful_servers($include_user=true) {
61    $list = 
62    array (
63       array('title' => "xmlrpc-epi ( local! )",
64             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
65             'args' => null,
66             'host' => $GLOBALS['SERVER_NAME'],
67             'uri' => substr($GLOBALS['PHP_SELF'], 0, strrpos($GLOBALS['PHP_SELF'], "/") + 1) . "interop-server.php",
68             'port' => $GLOBALS['SERVER_PORT'],
69             "default" => true
70             ),
71       array('title' => "Meerkat",
72             'info_link' => "http://www.oreillynet.com/meerkat/xml-rpc/",
73             'args' => null,
74             'host' => "www.oreillynet.com",
75             'uri' => "/meerkat/xml-rpc/server.php",
76             'port' => 80
77             ),
78       array('title' => "Usefulinc",
79             'info_link' => "http://xmlrpc.usefulinc.com/php.html",
80             'args' => null,
81             'host' => "xmlrpc.usefulinc.com",
82             'uri' => "/demo/server.php",
83             'port' => 80
84             ),
85       );
86
87    if($include_user) {
88       $list[] = get_user_server();
89    }
90
91    return $list;
92 }
93
94 function get_introspection_servers($include_user=true) {
95    $list = 
96    array (
97       array('title' => "xmlrpc-epi interop server",
98             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
99             'args' => null,
100             'host' => $GLOBALS['SERVER_NAME'],
101             'uri' => substr($GLOBALS['PHP_SELF'], 0, strrpos($GLOBALS['PHP_SELF'], "/") + 1) . "interop-server.php",
102             'port' => $GLOBALS['SERVER_PORT'],
103             "default" => true
104             ),
105       array('title' => "xmlrpc-epi validation server",
106             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/validate.php",
107             'args' => null,
108             'host' => $GLOBALS['SERVER_NAME'],
109             'uri' => substr($GLOBALS['PHP_SELF'], 0, strrpos($GLOBALS['PHP_SELF'], "/") + 1) . "validate.php",
110             'port' => $GLOBALS['SERVER_PORT'],
111             ),
112       );
113
114    if($include_user) {
115       $list[] = get_user_server();
116    }
117
118    return $list;
119 }
120
121
122 function get_interop_servers($include_user=true) {
123    global $HTTP_SERVER_VARS;
124    $list = 
125    array (
126       array('title' => "local xmlrpc interop-server",
127             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
128             'desc' => "a php C extension utilizing the xmlrpc-epi library.  running locally.  by Dan Libby",
129             'args' => "",
130             'host' => $HTTP_SERVER_VARS['SERVER_NAME'],
131             'uri' => dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) . "/interop-server.php",
132             'port' => $HTTP_SERVER_VARS['SERVER_PORT'],
133             "default" => true
134             ),
135       array('title' => "Frontier 7.0b43",
136             'info_link' => "http://groups.yahoo.com/group/xml-rpc/message/2585",
137             'desc' => "Jake Savin's Server.  First Interop Node",
138             'args' => "",
139             'host' => "www.soapware.org",
140             'uri' => "/RPC2",
141             'port' => 80
142             ),
143       array('title' => "XMLRPC.Net",
144             'info_link' => "http://aspx.securedomains.com/cookcomputing/interopechotests.aspx",
145             'desc' => "client/server by Charles Cook",
146             'args' => "",
147             'host' => "aspx.securedomains.com",
148             'uri' => "/cookcomputing/interopechotests.aspx",
149             'port' => 80
150             ),
151       array('title' => "xmlrpc-c",
152             'info_link' => "http://xmlrpc-c.sourceforge.net",
153             'desc' => "a C library by Eric Kidd",
154             'args' => "",
155             'host' => "xmlrpc-c.sourceforge.net",
156             'uri' => "/cgi-bin/interop.cgi",
157             'port' => 80
158             ),
159       array('title' => "Usefulinc",
160             'info_link' => "http://xmlrpc.usefulinc.com/",
161             'desc' => "a PHP script library by Edd Dumbill",
162             'args' => "",
163             'host' => "xmlrpc.usefulinc.com",
164             'uri' => "/demo/server.php",
165             'port' => 80
166             ),
167       array('title' => "XML-RPC for ASP",
168             'info_link' => "http://aspxmlrpc.sourceforge.net",
169             'args' => "",
170             'host' => "www.wc.cc.va.us",
171             'uri' => "/dtod/xmlrpc/testing/interop.asp",
172             'port' => 80
173             ),
174       array('title' => "Frontier-RPC 0.07b3 (Perl)",
175             'args' => "",
176             'host' => "bitsko.slc.ut.us",
177             'uri' => "/cgi-bin/interop.pl",
178             'port' => 80
179             ),
180       array('title' => "XMLRPC::Lite, v0.50",
181             'args' => "",
182             'host' => "xmlrpc.soaplite.com",
183             'uri' => "/interop.cgi",
184             'port' => 80
185             )
186    );
187
188    if($include_user) {
189       $list[] = get_user_server();
190    }
191
192    return $list;
193 }
194
195 function print_servers_form($server_list, $action_url=false, $print_user=true) {
196    $action = $action_url ? "action='$action_url'" : "";
197
198    echo "<form method='get' $action>";
199
200    foreach ($server_list as $key => $server) {
201       $title = $server['title'];
202       $link = $server['info_link'];
203       $type = $server['type'];
204       $port = $server['port'];
205       $default = $server["default"] ? "checked" : "";
206       if($link) {
207          $title = "<a href='$link'>$title</a>";
208       }
209       echo "<input type='radio' name='server' value='$key' $default>&nbsp;$title<br>";
210       
211       if($type === "user") {
212          echo "<DL><DT><DL><DT>host: <input type='text' name='user_host' size='50'></DT>" .
213               "<DT>uri: <input type='text' name='user_uri' size='50'>" .
214               "<DT>port: <input type='text' name='user_port' size='4' MAXLENGTH='4' VALUE='$port'></DT></DL></DT></DL>";
215          
216       }
217    }
218    if ($GLOBALS['HTTP_GET_VARS']['start_debug'])
219        echo "<input type='hidden' name='start_debug' value='1'>";
220    echo <<< END
221    <h3>Verbosity level</h3>
222       <input type='radio' name='debug' value='0' checked>none &nbsp;&nbsp;
223       <input type='radio' name='debug' value='1'>some &nbsp;&nbsp;
224       <input type='radio' name='debug' value='2'>much &nbsp;&nbsp;
225
226         <h3>XML Serialization</h3>
227                 <input type='radio' name='version' value='xmlrpc' checked>XML-RPC &nbsp;&nbsp;
228                 <input type='radio' name='version' value='soap 1.1'>SOAP &nbsp;&nbsp;
229                 <input type='radio' name='version' value='simple'>simpleRPC &nbsp;&nbsp;
230 <p>
231 <input type='submit' value='Start test'>
232 </form>
233
234 END;
235 }
236
237 function get_server_from_user($server_list) {
238    return $server_list[$GLOBALS['HTTP_GET_VARS']['server']];
239 }
240
241 function server_uri_vars() {
242    extract($GLOBALS['HTTP_GET_VARS']);
243    return "server=$server&user_host=$user_host&user_port=$user_port&user_uri=$user_uri";
244 }
245
246 function server_vars() {
247    extract($GLOBALS['HTTP_GET_VARS']);
248    return array(
249       'server' => $server,
250       'user_host' => $user_host,
251       'user_port' => $user_port,
252       'user_uri' => $user_uri
253       );
254 }
255
256 ?>