aboutsummaryrefslogtreecommitdiff
path: root/lib/soap/StudipSoapClient_PHP5.php
diff options
context:
space:
mode:
authorPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
committerPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
commit4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch)
tree5c07151ae61276d334e88f6309c30d439a85c12e /lib/soap/StudipSoapClient_PHP5.php
parentda0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff)
parent97a188592c679890a25c37ab78463add76a52ff7 (diff)
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/soap/StudipSoapClient_PHP5.php')
-rw-r--r--lib/soap/StudipSoapClient_PHP5.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/soap/StudipSoapClient_PHP5.php b/lib/soap/StudipSoapClient_PHP5.php
new file mode 100644
index 0000000..0aafd4a
--- /dev/null
+++ b/lib/soap/StudipSoapClient_PHP5.php
@@ -0,0 +1,63 @@
+<?
+# Lifter002: TODO
+# Lifter010: TODO
+/**
+* Adapter for using php5 ext:soap with Ilias3Soap
+*
+*
+* @author Andre Noack <noack@data-quest.de>
+* @access public
+* @package ELearning-Interface
+*/
+class StudipSoapClient
+{
+ var $soap_client;
+ var $error;
+
+ function __construct($path)
+ {
+ try {
+ $this->soap_client = new SoapClient($path, ['trace' => 0]);
+ } catch (SoapFault $fault) {
+ $this->error = "Soap Constructor Error " . $fault->faultcode . ": ".$fault->faultstring;
+ }
+ }
+
+ function _call($method, $params)
+ {
+ $result = false;
+ if ($this->soap_client instanceOf SoapClient) {
+ $this->faultstring = "";
+ try {
+ $result = $this->soap_client->__soapCall($method, $params);
+ } catch (SoapFault $fault) {
+ $this->faultstring = $fault->faultstring;
+ if (!in_array(mb_strtolower($this->faultstring), ["session not valid","session invalid", "session idled"])) {
+ unset($params['password']);
+ $this->error .= sprintf(_("SOAP-Fehler, Funktion \"%s\":"), $method) . " " . $fault->faultstring . " (" . $fault->faultcode . ")".print_r($params,1);
+ error_log($this->error);
+ }
+ $this->soap_client->fault = true;
+ return false;
+ }
+ if (is_object($result)) $result = (array)$result;
+ if (is_array($result)){
+ foreach($result as $index => $one){
+ if (is_object($one)) $result[$index] = (array)$one;
+ }
+ }
+ $this->soap_client->fault = false;
+ }
+ return $result;
+ }
+
+ function getError()
+ {
+ $error = $this->error;
+ $this->error = "";
+ if ($error != "")
+ return $error;
+ else
+ return false;
+ }
+}