/** * This method returns the URL of the specified service on the specified * host. * * @param service * The name of the service. * @param protocol * The service protocol * @param host * The service host name * @param port * The service listening port * @param validate * Validate the protocol, host and port of AM server * @return The URL of the specified service on the specified host. */ public static function getServiceURLAndValidate($service, $protocol, $host, $port, $validate) { // check before the first naming table update to avoid deadlock if ($protocol == null || $host == null || $port == null || strlen($protocol) == 0 || strlen($host) == 0 || strlen($port) == 0) { throw new Exception("No service URL: " . $service); } if (WebtopNaming::$ignoreNaming) { $protocol = WebtopNaming::$amServerProtocol; $host = WebtopNaming::$amServer; $port = WebtopNaming::$amServerPort; } if (WebtopNaming::$namingTable == null) { WebtopNaming::getNamingProfile(false); } $url = null; $name = "iplanet-am-naming-" . strtolower($service) . "-url"; $url = WebtopNaming::$namingTable[$name]; if ($url != null) { // If replacement is required, the protocol, host, and port // validation is needed against the server list // (iplanet-am-platform-server-list) if ($validate && strpos($url, "%")) { WebtopNaming::validate($protocol, $host, $port); } // %protocol processing $url = str_replace("%protocol", $protocol, $url); // %host processing $url = str_replace("%host", $host, $url); // %port processing $url = str_replace("%port", $port, $url); return $url; } else { throw new Exception("No service URL: " . $service); } }