SoapDiscovery.class.php source code is as follows:
============================================================
1
Php23/**4* Copyright (c) 2005, Braulio Jos? Solano Rojas5* All rights reserved.6 * 7* Redistribution and use in source and binary forms, with or without modification, is8* Permitted provided that the following conditions is met:9 * Ten* Redistributions of source code must retain the above copyright notice, this list of One* Conditions and the following disclaimer. A* 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. the* 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 are provided by the COPYRIGHT holders and -* CONTRIBUTORS ' as is ' and any EXPRESS OR implied warranties, +* including, LIMITED to, the implied warranties of A* merchantability and FITNESS for A particular PURPOSE is at* disclaimed. In NO EVENT shall the COPYRIGHT OWNER OR -* CONTRIBUTORS is liable for any DIRECT, INDIRECT, incidental, -* Special, exemplary, OR consequential damages (including, but -* 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 in* Contract, STRICT liability, or TORT (including negligence OR -* OTHERWISE) arising in any-on-the-the-software, to* Even IF advised of the possibility of SUCH DAMAGE. + * - * the* @version $Id $ ** @copyright 2005 $*/Panax Notoginseng -/** the* Soapdiscovery Class that provides Web Service Definition Language (WSDL). + * A* @package soapdiscovery the* @author Braulio Jos? Solano Rojas +* @copyright Copyright (c) 2005 Braulio Jos? Solano Rojas -* @version $Id $ $* @access Public $ **/ -classSoapdiscovery { -Private$class _name= ''; thePrivate$service _name= ''; -Wuyi/** the* SOAPDISCOVERY::__CONSTRUCT () Soapdiscovery class Constructor. - * Wu* @param string $class _name -* @param string $service _name About **/ $ Publicfunction__construct ($class _name= '',$service _name= '') { -$this->class_name =$class _name; -$this->service_name =$service _name; - } A +/** the* SOAPDISCOVERY::GETWSDL () Returns The WSDL of a class if the class is instantiable. - * $* @return String the **/ the Publicfunctiongetwsdl () { theif(Empty($this-service_name)) { theThrowNewException(' No service ' name. '); - } in$headerWSDL= "
\ n "; the$headerWSDL.= "
$this->service_name\ "targetnamespace=\" urn:
$this->service_name\ "xmlns:wsdl=\" http://schemas.xmlsoap.org/wsdl/\ "xmlns:soap=\" http://schemas.xmlsoap.org/wsdl /soap/\ "xmlns:tns=\" urn:
$this->service_name\ "xmlns:xsd=\" http://www.w3.org/2001/xmlschema\ "xmlns:soap-enc=\" http://schemas.xmlsoap.org/ Soap/encoding/\ "xmlns=\" http://schemas.xmlsoap.org/wsdl/\ ">\n"
;
the
$headerWSDL.= "
\ n "
;
About
the
if(
Empty(
$this-
class_name)) {
the
Throw
New
Exception(' No class ' name. '
);
the
}
+
-
$class=
NewReflectionclass (
$this-
class_name);
the
Bayi
if(!
$class-
isinstantiable ()) {
the
Throw
New
Exception(' Class is not instantiable. ')
);
the
}
-
-
$methods=
$class-
GetMethods ();
the
the
$portTypeWSDL= '
'
;
the
$bindingWSDL= '
\ n
\ n "
;
the
$serviceWSDL= '
\
nyou
$this->service_name. ' Port ' binding= ' TNS: '.
$this->service_name. " binding\ ">
$_server[' server_name ']. ': '.
$_server [' Server_port '].
$_server [' Php_self ']. " \ "/>\n
\ n
\ n "
;
-
$messageWSDL= ''
;
the
foreach(
$methods
as
$method
) {
the
if(
$method->ispublic () &&!
$method-
Isconstructor ()) {
the
$portTypeWSDL.= '
\ n "."
\ n
$method->getname (). " Response\ "/>\n
\ n "
;
94
$bindingWSDL.= '
\ n "."
\ n
$this->service_name\ "encodingstyle=\" http://schemas.xmlsoap.org/soap/encoding/\ "/>\n\n
\ n
$this->service_name\ "encodingstyle=\" http://schemas.xmlsoap.org/soap/encoding/\ "/>\n
\ n
\ n "
;
the
$messageWSDL.= '
\ n "
;
the
$parameters =
$method
-getparameters ();
the
foreach (
$parameters
as
$parameter
) {
98
$messageWSDL. = '
\ n "
;
About
}
$messageWSDL. = "
\ n "
;
101
$messageWSDL.= '
\ n "
;
102
$messageWSDL. = '
\ n '
;
103
$messageWSDL. = "
\ n "
;
104
}
the
}
106
$portTypeWSDL.= "
\ n "
;
107
$bindingWSDL.= "\ n "
;
108
//
return sprintf ('%s%s%s%s%s%s ', $headerWSDL, $portTypeWSDL, $bindingWSDL, $serviceWSDL, $messageWSDL, '
');109 the$fso=fopen($this->class_name. ". wsdl", "W");111fwrite($fso,sprintf('%s%s%s%s%s%s ',$headerWSDL,$portTypeWSDL,$bindingWSDL,$serviceWSDL,$messageWSDL, '')); the }113 the/** the* soapdiscovery::getdiscovery () Returns discovery of WSDL. the * 117* @return String118 **/119 PublicfunctionGetdiscovery () { -return"
\ n
\
$_server[' server_name ']. ': '.
$_server
[' Server_port '].
$_server [' Php_self ']. "? Wsdl\ "/>\n
";121 }122}123124?>
The above describes the soapdiscoveryclassphp, including the discovery aspects of the content, I hope that the PHP tutorial interested in a friend helpful.