/** * get the root url for a given ressource type. Root URLs are stored in config file. * @param string $ressourceType Name of the ressource * @return string the root URL corresponding to this ressource, or basePath if unknown */ public static function getRootUrl($ressourceType) { $rootUrl = jUrl::getRootUrlRessourceValue($ressourceType); if ($rootUrl !== null) { if (substr($rootUrl, 0, 7) !== 'http://' && substr($rootUrl, 0, 8) !== 'https://' && substr($rootUrl, 0, 1) !== '/') { //and is not relative to root // so let's prepend basePath : $rootUrl = jApp::config()->urlengine['basePath'] . $rootUrl; } } else { // basePath by default : $rootUrl = jApp::config()->urlengine['basePath']; } return $rootUrl; }
/** * Generate the WSDL content */ private function _compile() { $url = jUrl::get($this->module . '~' . $this->controller . ':index@soap', array(), jUrl::JURL); $url->clearParam(); $url->setParam('service', $this->module . '~' . $this->controller); $serverUri = jUrl::getRootUrlRessourceValue('soap'); if ($serverUri === null) { $serverUri = jUrl::getRootUrlRessourceValue('soap-' . $this->module); } if ($serverUri === null) { $serverUri = jUrl::getRootUrlRessourceValue('soap-' . $this->module . '-' . $this->controller); } if ($serverUri === null) { $serverUri = jApp::coord()->request->getServerURI(); } $serviceURL = $serverUri . $url->toString(); $serviceNameSpace = $serverUri . jApp::urlBasePath(); $wsdl = new WSDLStruct($serviceNameSpace, $serviceURL, SOAP_RPC, SOAP_ENCODED); $wsdl->setService(new IPReflectionClass($this->controllerClassName)); try { $gendoc = $wsdl->generateDocument(); } catch (WSDLException $exception) { throw new JException('jsoap~errors.wsdl.generation', $exception->msg); } return $gendoc; }
public static function getRootUrl($ressourceType) { $rootUrl = jUrl::getRootUrlRessourceValue($ressourceType); if ($rootUrl !== null) { if (substr($rootUrl, 0, 7) !== 'http://' && substr($rootUrl, 0, 8) !== 'https://' && substr($rootUrl, 0, 1) !== '/') { $rootUrl = jApp::config()->urlengine['basePath'] . $rootUrl; } } else { $rootUrl = jApp::config()->urlengine['basePath']; } return $rootUrl; }