ILIAS  release_8 Revision v8.23
dummy_client.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /******************************************************************************
6  *
7  * This file is part of ILIAS, a powerful learning management system.
8  *
9  * ILIAS is licensed with the GPL-3.0, you should have received a copy
10  * of said license along with the source code.
11  *
12  * If this is not the case or you just want to try ILIAS, you'll find
13  * us at:
14  * https://www.ilias.de
15  * https://github.com/ILIAS-eLearning
16  *
17  *****************************************************************************/
18 
20 include_once './webservice/soap/lib/nusoap.php';
21 
22 $server = $_GET["server"] ?: "http://localhost/Services/SOAPAuth/dummy_server.php";
23 
24 $ext_uid = $_GET["ext_uid"] ?: "testuser";
25 
26 $soap_pw = $_GET["soap_pw"] ?: "testpw";
27 
28 $new_user = $_GET["new_user"];
29 
30 echo '<form>' .
31  'server <input size="80" type="text" name="server" "value="' . $server . '"/>' .
32  '<br />ext_uid <input size="50" type="text" name="ext_uid" "value="' . $ext_uid . '"/>' .
33  '<br />soap_pw <input size="50" type="text" name="soap_pw" "value="' . $soap_pw . '"/>' .
34  '<br />new_user <input size="50" type="text" name="new_user" "value="' . $new_user . '"/> (1 for true, 0 for false)' .
35  '<br /><input type="submit" /><br />' .
36  '<b>The test server will return true/valid, if ext_uid == soap_pw.</b>' .
37  '</form>';
38 
39 echo "<br /><br />----------------------------------------------<br /><br /> Calling Server...";
40 
41 // initialize soap client
42 require_once './webservice/soap/lib/nusoap.php';
44 if ($err = $client->getError()) {
45  echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
46 }
47 
48 
49 // isValidSession call
50 //$valid = $client->call('isValidSession',
51 // array('ext_uid' => $ext_uid,
52 // 'soap_pw' => $soap_pw,
53 // 'new_user' => $new_user));
54 
55 $namespace = "http://testuri.org";
56 
57 $valid = $client->call(
58  'isValidSession',
59  [
60  'ns1:ext_uid' => $ext_uid,
61  'ns1:soap_pw' => $soap_pw,
62  'ns1:new_user' => $new_user
63  ],
64  $namespace,
65  $namespace . "/isValidSession"
66 );
67 
68 showResult($client, $valid, 'isValidSession');
69 
70 echo "<br />End Test";
71 
72 function showResult(nusoap_client $client, array $data, string $message): void
73 {
74  if ($client->fault) {
75  echo '<h2>Fault</h2><pre>';
76  print_r($data);
77  echo '</pre>';
78  } else {
79  // Check for errors
80  $err = $client->getError();
81  if ($err) {
82  // Display the error
83  echo '<h2>Error</h2><pre>' . $err . '</pre>';
84  exit;
85  } else {
86  // Display the result
87  echo '<h2>Result ' . $message . '</h2><pre>';
88  print_r($data ?: 'FAILED');
89  echo '</pre>';
90  }
91  }
92 }
if($err=$client->getError()) $namespace
$valid
$ext_uid
getError()
returns error string if present
Definition: nusoap.php:381
$client
$_GET['client_id']
Definition: saml1-acs.php:21
$soap_pw
[nu]soapclient higher level class for easy usage.
Definition: nusoap.php:7205
showResult(nusoap_client $client, array $data, string $message)
exit
$new_user
$server
$message
Definition: xapiexit.php:32