/** * Returns the WSDL content of the SOAP server. * If {@link getWsdlUri WsdlUri} is set, its content will be returned. * If not, the {@link setProvider Provider} class will be investigated * and the WSDL will be automatically genearted. * @return string the WSDL content of the SOAP server */ public function getWsdl() { if ($this->_wsdlUri === '') { $provider = $this->getProvider(); $providerClass = ($pos = strrpos($provider, '.')) !== false ? substr($provider, $pos + 1) : $provider; Prado::using($provider); if ($this->getApplication()->getMode() === TApplicationMode::Performance && ($cache = $this->getApplication()->getCache()) !== null) { $wsdl = $cache->get(self::WSDL_CACHE_PREFIX . $providerClass); if (is_string($wsdl)) { return $wsdl; } Prado::using('System.3rdParty.WsdlGen.WsdlGenerator'); $wsdl = WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); $cache->set(self::WSDL_CACHE_PREFIX . $providerClass, $wsdl); return $wsdl; } else { Prado::using('System.3rdParty.WsdlGen.WsdlGenerator'); return WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); } } else { return file_get_contents($this->_wsdlUri); } }
/** * Static method that generates and outputs the generated wsdl * @param string $className The name of the class to export * @param string $serviceUri The URI of the service that handles this WSDL * @param string $encoding character encoding. */ public static function generate($className, $serviceUri = '', $encoding = '') { $generator = WsdlGenerator::getInstance(); $generator->generateWsdl($className, $serviceUri, $encoding); //header('Content-type: text/xml'); return $generator->getWsdl(); //exit(); }
<?php require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/gtfw/wsdl_generator/WsdlGenerator.class.php'; if (isset($_GET['getlist'])) { WsdlGenerator::Instance()->GetList(); } else { WsdlGenerator::Instance()->GenerateWsdl(Configuration::Instance()->GetValue('wsdl', $_GET['nspace']->Raw())); }
static function Instance() { if (!isset(self::$mrInstance)) { self::$mrInstance = new WsdlGenerator(); } return self::$mrInstance; }