updates and such
[glcas.git] / archive / v1 / www / soap.php
1 <?php
2 require_once("../lib/lib.php");
3
4 ini_set("soap.wsdl_cache_enabled", "0");
5
6 $soapFunctions["status"] = "status";
7 global $soapFunctions;
8
9 function status($status)
10 {
11         $lk = new dataContainer();
12         $lk->stringpass[0] = "yes";
13         $lk->stringpass[1] = "np";
14         return $lk;
15 }
16
17 if(isset($_REQUEST["wsdl"])) {
18         $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
19         generateWSDL($mylocation, $soapFunctions);
20         exit(0);
21 }
22
23 if(isset($_REQUEST["xsd"])) {
24         $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
25         generateXSD($mylocation, $soapFunctions);
26         exit(0);
27 }
28
29 if($_SERVER["REQUEST_METHOD"] != "POST") {
30         $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
31         generateWSDL($mylocation, $soapFunctions);
32         exit(0);
33 }
34
35 function generateWSDL($location, $functions)
36 {
37         header("Content-type: text/xml");
38         $wsdl = sp_generateWSDL($location, $functions);
39         echo $wsdl;
40 }
41
42 function generateXSD($location, $functions)
43 {
44         header("Content-type: text/xml");
45         $wsdl = sp_generateXSD($location, $functions);
46         echo $wsdl;
47 }
48
49 $mylocation = "https://".$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
50 $s = new SoapServer("$mylocation?wsdl");
51
52 foreach($soapFunctions as $function) {
53         $s->addFunction($function);
54 }
55
56 $s->handle();
57
58
59 ?>