ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
dummy_client.php
Go to the documentation of this file.
1 <?php
2 
4 
5 //
6 // PART 3: Test it the normal way
7 //
8 
9 include_once ("./include/nusoap.php");
10 //include_once ("./include/class.ilXmlWriter.php");
11 
12 $server = $_GET["server"]
13  ? $_GET["server"]
14  : "http://www.ilias.de/lt4el/Services/SOAPAuth/dummy_server.php";
15 
16 $ext_uid = $_GET["ext_uid"]
17  ? $_GET["ext_uid"]
18  : "testuser";
19 
20 $soap_pw = $_GET["soap_pw"]
21  ? $_GET["soap_pw"]
22  : "testpw";
23 
24 $new_user = $_GET["new_user"];
25 
26 echo '<form>'.
27  'server <input size="80" type="text" name="server" "value="'.$server.'"/>'.
28  '<br />ext_uid <input size="50" type="text" name="ext_uid" "value="'.$ext_uid.'"/>'.
29  '<br />soap_pw <input size="50" type="text" name="soap_pw" "value="'.$soap_pw.'"/>'.
30  '<br />new_user <input size="50" type="text" name="new_user" "value="'.$new_user.'"/> (1 for true, 0 for false)'.
31  '<br /><input type="submit" /><br />'.
32  '<b>The test server will return true/valid, if ext_uid == soap_pw.</b>'.
33  '</form>';
34 
35 echo "<br /><br />----------------------------------------------<br /><br /> Calling Server...";
36 
37 // initialize soap client
39 if ($err = $client->getError())
40 {
41  echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
42 }
43 
44 
45 // isValidSession call
46 //$valid = $client->call('isValidSession',
47 // array('ext_uid' => $ext_uid,
48 // 'soap_pw' => $soap_pw,
49 // 'new_user' => $new_user));
50 
51 $namespace = "http://testuri.org";
52 
53 $valid = $client->call('isValidSession',
54  array('ns1:ext_uid' => $ext_uid,
55  'ns1:soap_pw' => $soap_pw,
56  'ns1:new_user' => $new_user), $namespace,
57  $namespace."/isValidSession");
58 
59 showResult($client,$valid,'isValidSession');
60 
61 echo "<br />End Test";
62 
63 function showResult(&$client,$data,$message)
64 {
65  if($client->fault) {
66  echo '<h2>Fault</h2><pre>';
67  print_r($data);
68  echo '</pre>';
69  }
70  else
71  {
72  // Check for errors
73  $err = $client->getError();
74  if ($err) {
75  // Display the error
76  echo '<h2>Error</h2><pre>' . $err . '</pre>';
77  exit;
78  } else {
79  // Display the result
80  echo '<h2>Result '.$message.'</h2><pre>';
81  print_r($data ? $data : 'FAILED');
82  echo '</pre>';
83  }
84  }
85 }
86 
87 ?>