Moving the old code aside into the archive as i begin a new
[glcas.git] / archive / v1 / www / soap.php
diff --git a/archive/v1/www/soap.php b/archive/v1/www/soap.php
new file mode 100644 (file)
index 0000000..577e359
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+require_once("../lib/lib.php");
+
+ini_set("soap.wsdl_cache_enabled", "0");
+
+$soapFunctions["status"] = "status";
+global $soapFunctions;
+
+function status($status)
+{
+       $lk = new dataContainer();
+       $lk->stringpass[0] = "yes";
+       $lk->stringpass[1] = "np";
+       return $lk;
+}
+
+if(isset($_REQUEST["wsdl"])) {
+       $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+       generateWSDL($mylocation, $soapFunctions);
+       exit(0);
+}
+
+if(isset($_REQUEST["xsd"])) {
+       $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+       generateXSD($mylocation, $soapFunctions);
+       exit(0);
+}
+
+if($_SERVER["REQUEST_METHOD"] != "POST") {
+       $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+       generateWSDL($mylocation, $soapFunctions);
+       exit(0);
+}
+
+function generateWSDL($location, $functions)
+{
+       header("Content-type: text/xml");
+       $wsdl = sp_generateWSDL($location, $functions);
+       echo $wsdl;
+}
+
+function generateXSD($location, $functions)
+{
+       header("Content-type: text/xml");
+       $wsdl = sp_generateXSD($location, $functions);
+       echo $wsdl;
+}
+
+$mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+$s = new SoapServer("$mylocation?wsdl");
+
+foreach($soapFunctions as $function) {
+       $s->addFunction($function);
+}
+
+$s->handle();
+
+
+?>
\ No newline at end of file