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