* View that shows the wsdl used for receiving soap calls * * @author G. Giunta * @copyright (C) 2011-2016 G. Giunta * @license code licensed under the GPL License: see LICENSE file * * @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 {
$protocol = 'SOAP'; $wsclass = 'PhpSOAP'; // continue voluntarily // continue voluntarily case 'REST': case 'JSONRPC': case 'XMLRPC': $data = file_get_contents('php://input'); break; default: /// @todo return an http error 500 or something like that ? echo $protocol == '' ? 'Protocol unspecified' : 'Unsupported protocol : ' . htmlspecialchars($protocol); 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
} $ini = eZINI::instance(); // Initialize/set the index file. eZSys::init(WS_PROTOCOL . '.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') == 'true'); $uri = eZURI::instance(eZSys::requestURI()); $GLOBALS['eZRequestedURI'] = $uri; // include ezsession override implementation require_once "lib/ezutils/classes/ezsession.php"; // Check for extension //include_once( 'lib/ezutils/classes/ezextension.php' ); require_once 'kernel/common/ezincludefunctions.php'; eZExtension::activateExtensions('default'); // Extension check end // Activate correct siteaccess require_once 'access.php'; $wsINI = eZINI::instance(ggeZWebservices::configFileByProtocol(WS_PROTOCOL)); if ($wsINI->variable('GeneralSettings', 'UseDefaultAccess') === 'enabled') { $access = array('name' => $ini->variable('SiteSettings', 'DefaultAccess'), 'type' => EZ_ACCESS_TYPE_DEFAULT); } else { $access = accessType($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile()); } $access = changeAccess($access); // Siteaccess activation end // reload wsproviders ini file, as there might be per-siteaccess settings $wsINI->loadCache(); // Check for activating Debug by user ID (Final checking. The first was in eZDebug::updateSettings()) eZDebug::checkDebugByUser(); // Check for siteaccess extension eZExtension::activateExtensions('access'); // Siteaccess extension check end /**