getting soap functional.
[glcas.git] / www / soap.php
index 454c201..281b468 100644 (file)
@@ -4,33 +4,54 @@ require_once("../lib/lib.php");
 $soapFunctions["status"] = "status";
 global $soapFunctions;
 
-function status()
+function status($status)
 {
-       return "im good";
+       $lk = new dataContainer();
+       $lk->stringpass[0] = "yes";
+       $lk->stringpass[1] = "np";
+       return $lk;
 }
 
 if(isset($_REQUEST["wsdl"])) {
-       generateWSDL();
+       $mylocation = "http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+       generateWSDL($mylocation, $soapFunctions);
        exit(0);
 }
 
 if(isset($_REQUEST["xsd"])) {
-       //generateXSD();
+       $mylocation = "http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+       generateXSD($mylocation, $soapFunctions);
        exit(0);
 }
 
-function generageWSDL()
+if($_SERVER["REQUEST_METHOD"] != "POST") {
+       $mylocation = "http://".$_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;
 }
 
-$s = new SoapServer(NULL, array( "uri" => "http://pjr.cc/glcas"));
+$mylocation = "http://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
+$s = new SoapServer("$mylocation?wsdl");
 
 foreach($soapFunctions as $function) {
        $s->addFunction($function);
 }
 
-print_r($s->getFunctions());
+$s->handle();
 
 
 ?>
\ No newline at end of file