您好,欢迎访问一九零五行业门户网

SOAP WebService的wsdl文件生成类

/** * copyright (c) 2005, braulio jos?solano rojas * all rights reserved. * * redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * redistributi
/** * copyright (c) 2005, braulio jos?solano rojas * all rights reserved. * * redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * neither the name of the solsoft de costa rica s.a. nor the names of its contributors may * be used to endorse or promote products derived from this software without specific * prior written permission. * * this software is provided by the copyright holders and * contributors as is and any express or implied warranties, * including, but not limited to, the implied warranties of * merchantability and fitness for a particular purpose are * disclaimed. in no event shall the copyright owner or * contributors be liable for any direct, indirect, incidental, * special, exemplary, or consequential damages (including, but * not limited to, procurement of substitute goods or services; * loss of use, data, or profits; or business interruption) * however caused and on any theory of liability, whether in * contract, strict liability, or tort (including negligence or * otherwise) arising in any way out of the use of this software, * even if advised of the possibility of such damage. * * * @version $id: soapdiscovery.class.php 66 2013-04-10 07:12:21z ideaa $ * @copyright 2005 *//** * soapdiscovery class that provides web service definition language (wsdl). * * @package soapdiscovery * @author braulio jos?solano rojas * @copyright copyright (c) 2005 braulio jos?solano rojas * @version $id: soapdiscovery.class.php 66 2013-04-10 07:12:21z ideaa $ * @access public * */class soapdiscovery { private $class_name = ''; private $service_name = ''; /** * soapdiscovery::__construct() soapdiscovery class constructor. * * @param string $class_name * @param string $service_name * */ public function __construct($class_name = '', $service_name = '') { $this->class_name = $class_name; $this->service_name = $service_name; } /** * soapdiscovery::getwsdl() returns the wsdl of a class if the class is instantiable. * * @return string * */ public function getwsdl() { if (empty($this->service_name)) { throw new exception('no service name.'); } $headerwsdl = \n; $headerwsdl.= \n; $headerwsdl.= \n; if (empty($this->class_name)) { throw new exception('no class name.'); } $class = new reflectionclass($this->class_name); if (!$class->isinstantiable()) { throw new exception('class is not instantiable.'); } $methods = $class->getmethods(); $porttypewsdl = ''; $bindingwsdl = 'service_name . 'binding type=tns:' . $this->service_name . port\>\n\n; $servicewsdl = 'service_name . \>\n\nservice_name . 'port binding=tns:' . $this->service_name . binding\>\n\n\n; $messagewsdl = ''; foreach ($methods as $method) { if ($method->ispublic() && !$method->isconstructor()) { $porttypewsdl.= 'getname() . \>\n . 'getname() . request\ />\ngetname() . response\ />\n\n; $bindingwsdl.= 'getname() . \>\n . 'service_name . '#' . $this->class_name . '#' . $method->getname() . \ />\n\n\n\n\n\n\n; $messagewsdl.= 'getname() . request\>\n; $parameters = $method->getparameters(); foreach ($parameters as $parameter) { $messagewsdl.= 'getname() . \ type=\xsd:string\ />\n; } $messagewsdl.= \n; $messagewsdl.= 'getname() . response\>\n; $messagewsdl.= 'getname() . \ type=\xsd:string\ />\n; $messagewsdl.= \n; } } $porttypewsdl.= \n; $bindingwsdl.= \n; return sprintf('%s%s%s%s%s%s', $headerwsdl, $porttypewsdl, $bindingwsdl, $servicewsdl, $messagewsdl, ''); } /** * soapdiscovery::getdiscovery() returns discovery of wsdl. * * @return string * */ public function getdiscovery() { return \n\n\n; }}
本文标题:soap webservice的wsdl文件生成类
本文链接:http://www.maben.com.cn/archives/702.html转载请注明出处
其它类似信息

推荐信息