/** * Handling of SOAP queries * * @copyright Copyright (C) 2010-2012 Combodo SARL * @license http://opensource.org/licenses/AGPL-3.0 */ // Important note: if some required includes are missing, this might result // in the error "looks like we got no XML document"... require_once('../approot.inc.php'); require_once(APPROOT.'/application/application.inc.php'); require_once(APPROOT.'/application/startup.inc.php'); // this file is generated dynamically with location = here $sWsdlUri = 'http'.((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off')) ? 's' : '').'://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].dirname($_SERVER['SCRIPT_NAME']).'/../webservices/itop.wsdl.php'; if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category']))) { $sWsdlUri .= "soapserver.php?service_category=".$_REQUEST['service_category']; } ini_set("soap.wsdl_cache_enabled","0"); $aSOAPMapping = SOAPMapping::GetMapping(); $oSoapServer = new SoapServer ( $sWsdlUri, array( 'classmap' => $aSOAPMapping ) ); // $oSoapServer->setPersistence(SOAP_PERSISTENCE_SESSION); if (isset($_REQUEST['service_category']) && (!empty($_REQUEST['service_category']))) { $sServiceClass = $_REQUEST['service_category']; if (!class_exists($sServiceClass)) { // not a valid class name (not a PHP class at all) throw new SoapFault("iTop SOAP server", "Invalid argument service_category: '$sServiceClass' is not a PHP class"); } elseif (!is_subclass_of($sServiceClass, 'WebServicesBase')) { // not a valid class name (not deriving from WebServicesBase) throw new SoapFault("iTop SOAP server", "Invalid argument service_category: '$sServiceClass' is not derived from WebServicesBase"); } else { $oSoapServer->setClass($sServiceClass, null); } } else { $oSoapServer->setClass('BasicServices', null); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $oSoapServer->handle(); } else { echo "This SOAP server can handle the following functions: "; $aFunctions = $oSoapServer->getFunctions(); echo "\n"; echo "

Here the WSDL file

"; echo "You may also want to try the following service categories: "; echo "

\n"; } ?>