soapserver.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * SOAP-based web service
  4. *
  5. * @package iTopORM
  6. * @author Romain Quetiez <romainquetiez@yahoo.fr>
  7. * @author Denis Flaven <denisflave@free.fr>
  8. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  9. * @link www.itop.com
  10. * @since 1.0
  11. * @version 1.1.1.1 $
  12. */
  13. // Important note: if some required includes are missing, this might result
  14. // in the error "looks like we got no XML document"...
  15. require_once('../application/application.inc.php');
  16. require_once('../application/startup.inc.php');
  17. require('./webservices.class.inc.php');
  18. // this file is generated dynamically with location = here
  19. $sWsdlUri = 'http'.(empty($_SERVER['HTTPS']) ? '' : 's').'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['SCRIPT_NAME']).'/../webservices/itop.wsdl.php';
  20. ini_set("soap.wsdl_cache_enabled","0");
  21. $oSoapServer = new SoapServer
  22. (
  23. $sWsdlUri,
  24. array(
  25. 'classmap' => $aSOAPMapping
  26. )
  27. );
  28. // $oSoapServer->setPersistence(SOAP_PERSISTENCE_SESSION);
  29. $oSoapServer->setClass('WebServices', null);
  30. if ($_SERVER["REQUEST_METHOD"] == "POST")
  31. {
  32. $oSoapServer->handle();
  33. }
  34. else
  35. {
  36. echo "This SOAP server can handle the following functions: ";
  37. $aFunctions = $oSoapServer->getFunctions();
  38. echo "<ul>\n";
  39. foreach($aFunctions as $sFunc)
  40. {
  41. echo "<li>$sFunc</li>\n";
  42. }
  43. echo "</ul>\n";
  44. echo "<p>Here the <a href=\"$sWsdlUri\">WSDL file</a><p>";
  45. }
  46. ?>