* @todo add support for letting user choose WSDL 2.0 */ // decode input params $module = $Params['Module']; $ws = $Params['webservice']; $output_type = $Params['ViewMode'] == 'html' ? 'html' : 'wsdl'; $wsdl_version = 1; $external_typedefs = false; // check if soap is enabled $wsINI = eZINI::instance(ggeZWebservices::configFileByProtocol('soap')); if ($wsINI->variable('GeneralSettings', 'EnableSOAP') == 'true') { //$namespaceURI = ''; $server = new ggPhpSOAPServer(); // nb: this will register methods declared only for soap or for all // protocols, depending on ini settings ggeZWebservices::registerAvailableMethods($server, 'soap'); /// @todo register ezjscore methods (hard to do...) // check perms: only show wsdl for methods user has access to $methods = false; $user = eZUser::currentUser(); $accessResult = $user->hasAccessTo('webservices', 'wsdl'); $accessWord = $accessResult['accessWord']; if ($accessWord == 'yes') { $methods = $ws; } else { $accessResult = $user->hasAccessTo('webservices', 'execute'); $accessWord = $accessResult['accessWord']; if ($accessWord == 'yes') { $methods = $ws; } else { if ($accessWord != 'no') {
eZExecution::cleanExit(); die; } $wsINI = eZINI::instance(ggeZWebservices::configFileByProtocol(strtolower($protocol))); if ($wsINI->variable('GeneralSettings', 'Enable' . $protocol) != 'true') { /// @todo return an http error 500 or something like that ? echo 'Disabled protocol : ' . htmlspecialchars($protocol); eZExecution::cleanExit(); die; } $namespaceURI = ''; $serverClass = 'gg' . $wsclass . 'Server'; $server = new $serverClass(); // nb: this will register methods declared only for $protocol or for all // protocols, depending on ini settings ggeZWebservices::registerAvailableMethods($server, strtolower($protocol)); // from here onwards, we do the same as normally the server would do in a // single processRequest call. We need to add extra perms checking halfway // through, so we replicate the code here (we also add some ezjscore-support // hacks) $data = $server->inflateRequest($data); if ($data === false) { $server->showResponse('unknown_function_name', $namespaceURI, new ggWebservicesFault(ggWebservicesServer::INVALIDCOMPRESSIONERROR, ggWebservicesServer::INVALIDCOMPRESSIONSTRING)); eZExecution::cleanExit(); die; } $request = $server->parseRequest($data); // invalid request: error out if (!is_object($request)) { $server->showResponse('unknown_function_name', $namespaceURI, new ggWebservicesFault(ggWebservicesServer::INVALIDREQUESTERROR, ggWebservicesServer::INVALIDREQUESTSTRING)); eZExecution::cleanExit();
list($i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension']) = $ini->variableMulti('CharacterSettings', array('Charset', 'HTTPCharset', 'MBStringExtension'), array(false, false, 'enabled')); //include_once( 'lib/ezi18n/classes/eztextcodec.php' ); eZTextCodec::updateSettings($i18nSettings); } // Initialize text codec settings eZUpdateTextCodecSettings(); //include_once( 'lib/ezdb/classes/ezdb.php' ); //$db = eZDB::instance(); // Initialize module loading //include_once( "lib/ezutils/classes/ezmodule.php" ); $moduleRepositories = eZModule::activeModuleRepositories(); eZModule::setGlobalPathList($moduleRepositories); // Load extensions $enable = $wsINI->variable('GeneralSettings', 'Enable' . strtoupper(WS_PROTOCOL)); if ($enable == 'true') { eZSys::init(WS_PROTOCOL . '.php'); //include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' ); // Login if we have username and password. if (eZHTTPTool::username() and eZHTTPTool::password()) { eZUser::loginUser(eZHTTPTool::username(), eZHTTPTool::password()); } //include_once( 'lib/ezsoap/classes/ezsoapserver.php' ); $server_class = 'gg' . strtoupper(WS_PROTOCOL) . 'Server'; $server = new $server_class(); // nb: this will register methods declared only for $protocol or for all // protocols, depending on ini settings ggeZWebservices::registerAvailableMethods($server, WS_PROTOCOL); $server->processRequest(); } ob_end_flush(); eZExecution::cleanExit();