diff options
Diffstat (limited to 'lib/soap/StudipSoapClient.php')
| -rw-r--r-- | lib/soap/StudipSoapClient.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/soap/StudipSoapClient.php b/lib/soap/StudipSoapClient.php new file mode 100644 index 0000000..f6c0cad --- /dev/null +++ b/lib/soap/StudipSoapClient.php @@ -0,0 +1,58 @@ +<? +# Lifter002: TODO +# Lifter007: TODO +# Lifter003: TODO +# Lifter010: TODO +class StudipSoapClient +{ + var $soap_client; + var $error; + var $faultstring; + + function __construct($path) + { + require_once("vendor/nusoap/nusoap.php"); + + $this->soap_client = new soap_client($path, true); + $this->soap_client->soap_defencoding = 'UTF-8'; + $this->soap_client->decode_utf8 = false; + $this->soap_client->setDebugLevel(0); + + $err = $this->soap_client->getError(); + if ($err) + $this->error = "<b>Soap Constructor Error</b><br>" . $err . "<br><br>"; + } + + function _call($method, $params) + { + $this->faultstring = ""; + $result = $this->soap_client->call($method, $params); + + if ($this->soap_client->fault) + { + $this->faultstring = $result["faultstring"]; + if (!in_array(mb_strtolower($this->faultstring), ["session not valid","session invalid", "session idled"])) + $this->error .= "<b>" . sprintf(_("SOAP-Fehler, Funktion \"%s\":"), $method) . "</b> " . $result["faultstring"] . " (" . $result["faultcode"] . ")<br>"; + } else { + $err = $this->soap_client->getError(); + if ($err) { + $this->error .= "<b>" . sprintf(_("SOAP-Fehler, Funktion \"%s\":"), $method) . "</b> " . $err . "<br>"; + } else { + return $result; + } + } + error_log($this->error); + return false; + } + + function getError() + { + $error = $this->error; + $this->error = ""; + if ($error != "") + return $error; + else + return false; + } +} +?> |
