ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
dummy_client.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 require_once __DIR__ . '/../../soap/lib/nusoap.php';
23 
24 $server = $_GET["server"] ?: "http://localhost/Services/SOAPAuth/dummy_server.php";
25 
26 $ext_uid = $_GET["ext_uid"] ?: "testuser";
27 
28 $soap_pw = $_GET["soap_pw"] ?: "testpw";
29 
30 $new_user = $_GET["new_user"];
31 
32 echo '<form>' .
33  'server <input size="80" type="text" name="server" "value="' . $server . '"/>' .
34  '<br />ext_uid <input size="50" type="text" name="ext_uid" "value="' . $ext_uid . '"/>' .
35  '<br />soap_pw <input size="50" type="text" name="soap_pw" "value="' . $soap_pw . '"/>' .
36  '<br />new_user <input size="50" type="text" name="new_user" "value="' . $new_user . '"/> (1 for true, 0 for false)' .
37  '<br /><input type="submit" /><br />' .
38  '<b>The test server will return true/valid, if ext_uid == soap_pw.</b>' .
39  '</form>';
40 
41 echo "<br /><br />----------------------------------------------<br /><br /> Calling Server...";
42 
43 // initialize soap client
44 require_once __DIR__ . '/../../soap/lib/nusoap.php';
46 if ($err = $client->getError()) {
47  echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
48 }
49 
50 
51 // isValidSession call
52 //$valid = $client->call('isValidSession',
53 // array('ext_uid' => $ext_uid,
54 // 'soap_pw' => $soap_pw,
55 // 'new_user' => $new_user));
56 
57 $namespace = "http://testuri.org";
58 
59 $valid = $client->call(
60  'isValidSession',
61  [
62  'ns1:ext_uid' => $ext_uid,
63  'ns1:soap_pw' => $soap_pw,
64  'ns1:new_user' => $new_user
65  ],
66  $namespace,
67  $namespace . "/isValidSession"
68 );
69 
70 showResult($client, $valid, 'isValidSession');
71 
72 echo "<br />End Test";
73 
74 function showResult(nusoap_client $client, array $data, string $message): void
75 {
76  if ($client->fault) {
77  echo '<h2>Fault</h2><pre>';
78  print_r($data);
79  echo '</pre>';
80  } else {
81  // Check for errors
82  $err = $client->getError();
83  if ($err) {
84  // Display the error
85  echo '<h2>Error</h2><pre>' . $err . '</pre>';
86  exit;
87  } else {
88  // Display the result
89  echo '<h2>Result ' . $message . '</h2><pre>';
90  print_r($data ?: 'FAILED');
91  echo '</pre>';
92  }
93  }
94 }
if($err=$client->getError()) $namespace
$_GET["client_id"]
Definition: webdav.php:30
$valid
$ext_uid
getError()
returns error string if present
Definition: nusoap.php:339
$client
$soap_pw
[nu]soapclient higher level class for easy usage.
Definition: nusoap.php:7182
showResult(nusoap_client $client, array $data, string $message)
exit
$new_user
$server
$message
Definition: xapiexit.php:31