


SoapDiscovery.class.php source code is as follows:
========================================== =====================
<span> 1</span> <span>php </span><span> 2</span><span> 3</span><span>/*</span><span>* </span><span> 4</span><span> * Copyright (c) 2005, Braulio Jos?Solano Rojas </span><span> 5</span><span> * All rights reserved. </span><span> 6</span><span> * </span><span> 7</span><span> * Redistribution and use in source and binary forms, with or without modification, are </span><span> 8</span><span> * permitted provided that the following conditions are met: </span><span> 9</span><span> * </span><span> 10</span><span> * Redistributions of source code must retain the above copyright notice, this list of </span><span> 11</span><span> * conditions and the following disclaimer. </span><span> 12</span><span> * Redistributions in binary form must reproduce the above copyright notice, this list of </span><span> 13</span><span> * conditions and the following disclaimer in the documentation and/or other materials </span><span> 14</span><span> * provided with the distribution. </span><span> 15</span><span> * Neither the name of the Solsoft de Costa Rica S.A. nor the names of its contributors may </span><span> 16</span><span> * be used to endorse or promote products derived from this software without specific </span><span> 17</span><span> * prior written permission. </span><span> 18</span><span> * </span><span> 19</span><span> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND </span><span> 20</span><span> * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, </span><span> 21</span><span> * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF </span><span> 22</span><span> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE </span><span> 23</span><span> * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR </span><span> 24</span><span> * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, </span><span> 25</span><span> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT </span><span> 26</span><span> * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; </span><span> 27</span><span> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) </span><span> 28</span><span> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN </span><span> 29</span><span> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span> 30</span><span> * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, </span><span> 31</span><span> * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </span><span> 32</span><span> * </span><span> 33</span><span> * </span><span> 34</span><span> * @version $Id$ </span><span> 35</span><span> * @copyright 2005 </span><span> 36</span><span>*/</span><span> 37</span><span> 38</span><span>/*</span><span>* </span><span> 39</span><span> * SoapDiscovery Class that provides Web Service Definition Language (WSDL). </span><span> 40</span><span> * </span><span> 41</span><span> * @package SoapDiscovery </span><span> 42</span><span> * @author Braulio Jos?Solano Rojas </span><span> 43</span><span> * @copyright Copyright (c) 2005 Braulio Jos?Solano Rojas </span><span> 44</span><span> * @version $Id$ </span><span> 45</span><span> * @access public </span><span> 46</span><span> *</span><span>*/</span><span> 47</span><span>class</span><span> SoapDiscovery { </span><span> 48</span><span>private</span><span>$class_name</span> = ''<span>; </span><span> 49</span><span>private</span><span>$service_name</span> = ''<span>; </span><span> 50</span><span> 51</span><span>/*</span><span>* </span><span> 52</span><span> * SoapDiscovery::__construct() SoapDiscovery class Constructor. </span><span> 53</span><span> * </span><span> 54</span><span> * @param string $class_name </span><span> 55</span><span> * @param string $service_name </span><span> 56</span><span> *</span><span>*/</span><span> 57</span><span>public</span><span>function</span> __construct(<span>$class_name</span> = '', <span>$service_name</span> = ''<span>) { </span><span> 58</span><span>$this</span>->class_name = <span>$class_name</span><span>; </span><span> 59</span><span>$this</span>->service_name = <span>$service_name</span><span>; </span><span> 60</span><span> } </span><span> 61</span><span> 62</span><span>/*</span><span>* </span><span> 63</span><span> * SoapDiscovery::getWSDL() Returns the WSDL of a class if the class is instantiable. </span><span> 64</span><span> * </span><span> 65</span><span> * @return string </span><span> 66</span><span> *</span><span>*/</span><span> 67</span><span>public</span><span>function</span><span> getWSDL() { </span><span> 68</span><span>if</span> (<span>empty</span>(<span>$this</span>-><span>service_name)) { </span><span> 69</span><span>throw</span><span>new</span><span>Exception</span>('No service name.'<span>); </span><span> 70</span><span> } </span><span> 71</span><span>$headerWSDL</span> = "<?xml version=\"1.0\" ?>\n"<span>; </span><span> 72</span><span>$headerWSDL</span>.= "<definitions name='\"<span'>$this->service_name\" targetNamespace=\"urn:<span>$this</span>->service_name\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:tns=\"urn:<span>$this</span>->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"<span>; </span><span> 73</span><span>$headerWSDL</span>.= "<types xmlns='\"http://schemas.xmlsoap.org/wsdl/\"'></types>\n"<span>; </span><span> 74</span><span> 75</span><span>if</span> (<span>empty</span>(<span>$this</span>-><span>class_name)) { </span><span> 76</span><span>throw</span><span>new</span><span>Exception</span>('No class name.'<span>); </span><span> 77</span><span> } </span><span> 78</span><span> 79</span><span>$class</span> = <span>new</span> ReflectionClass(<span>$this</span>-><span>class_name); </span><span> 80</span><span> 81</span><span>if</span> (!<span>$class</span>-><span>isInstantiable()) { </span><span> 82</span><span>throw</span><span>new</span><span>Exception</span>('Class is not instantiable.'<span>); </span><span> 83</span><span> } </span><span> 84</span><span> 85</span><span>$methods</span> = <span>$class</span>-><span>getMethods(); </span><span> 86</span><span> 87</span><span>$portTypeWSDL</span> = '<porttype name="'.<span>$this</span>->service_name.'Port">'<span>; </span><span> 88</span><span>$bindingWSDL</span> = '<binding name="'.<span>$this</span>->service_name.'Binding" type="tns:'.<span>$this</span>->service_name." port>\n<binding style='\"rpc\"' transport='\"http://schemas.xmlsoap.org/soap/http\"'></binding>\n"<span>; </span><span> 89</span><span>$serviceWSDL</span> = '<service name="'.<span>$this</span>->service_name.">\n<documentation></documentation>\n<port name='\"".<span'>$this->service_name.'Port" binding="tns:'.<span>$this</span>->service_name."Binding\"><address location='\"http://".<span'>$_SERVER['SERVER_NAME'].':'.<span>$_SERVER</span>['SERVER_PORT'].<span>$_SERVER</span>['PHP_SELF']."\" />\n</address></port>\n</service>\n"<span>; </span><span> 90</span><span>$messageWSDL</span> = ''<span>; </span><span> 91</span><span>foreach</span> (<span>$methods</span><span>as</span><span>$method</span><span>) { </span><span> 92</span><span>if</span> (<span>$method</span>->isPublic() && !<span>$method</span>-><span>isConstructor()) { </span><span> 93</span><span>$portTypeWSDL</span>.= '<operation name="'.<span>$method</span>->getName().">\n".'<input message="tns:'.<span>$method</span>->getName()." request>\n<output message='\"tns:".<span'>$method->getName()."Response\" />\n</output></operation>\n"<span>; </span><span> 94</span><span>$bindingWSDL</span>.= '<operation name="'.<span>$method</span>->getName().">\n".'<operation soapaction="urn:'.<span>$this</span>->service_name.'#'.<span>$this</span>->class_name.'#'.<span>$method</span>->getName()."></operation>\n<input><body use='\"encoded\"' namespace='\"urn:<span'>$this->service_name\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />\n\n<output>\n<body use='\"encoded\"' namespace='\"urn:<span'>$this->service_name\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" />\n</body></output>\n</body></operation>\n"<span>; </span><span> 95</span><span>$messageWSDL</span>.= '<message name="'.<span>$method</span>->getName()." request>\n"<span>; </span><span> 96</span><span>$parameters</span> = <span>$method</span>-><span>getParameters(); </span><span> 97</span><span>foreach</span> (<span>$parameters</span><span>as</span><span>$parameter</span><span>) { </span><span> 98</span><span>$messageWSDL</span>.= '<part name="'.<span>$parameter</span>->getName()." type='\"xsd:string\"'></part>\n"<span>; </span><span> 99</span><span> } </span><span>100</span><span>$messageWSDL</span>.= "</message>\n"<span>; </span><span>101</span><span>$messageWSDL</span>.= '<message name="'.<span>$method</span>->getName()." response>\n"<span>; </span><span>102</span><span>$messageWSDL</span>.= '<part name="'.<span>$method</span>->getName()." type='\"xsd:string\"'></part>\n"<span>; </span><span>103</span><span>$messageWSDL</span>.= "</message>\n"<span>; </span><span>104</span><span> } </span><span>105</span><span> } </span><span>106</span><span>$portTypeWSDL</span>.= "</binding></porttype>\n"<span>; </span><span>107</span><span>$bindingWSDL</span>.= "\n"<span>; </span><span>108</span><span>//</span><span>return sprintf('%s%s%s%s%s%s', $headerWSDL, $portTypeWSDL, $bindingWSDL, $serviceWSDL, $messageWSDL, '</span></definitions>');<span>109</span><span>110</span><span>$fso</span> = <span>fopen</span>(<span>$this</span>->class_name . ".wsdl", "w"<span>); </span><span>111</span><span>fwrite</span>(<span>$fso</span>, <span>sprintf</span>('%s%s%s%s%s%s', <span>$headerWSDL</span>, <span>$portTypeWSDL</span>, <span>$bindingWSDL</span>, <span>$serviceWSDL</span>, <span>$messageWSDL</span>, ''<span>)); </span><span>112</span><span> } </span><span>113</span><span>114</span><span>/*</span><span>* </span><span>115</span><span> * SoapDiscovery::getDiscovery() Returns discovery of WSDL. </span><span>116</span><span> * </span><span>117</span><span> * @return string </span><span>118</span><span> *</span><span>*/</span><span>119</span><span>public</span><span>function</span><span> getDiscovery() { </span><span>120</span><span>return</span> "<?xml version=\"1.0\" ?>\n<discovery xmlns:disco='\"http://schemas.xmlsoap.org/disco/\"' xmlns:scl='\"http://schemas.xmlsoap.org/disco/scl/\"'>\n<contractref ref='\"http://".<span'>$_SERVER['SERVER_NAME'].':'.<span>$_SERVER</span>['SERVER_PORT'].<span>$_SERVER</span>['PHP_SELF']."?wsdl\" />\n</contractref></discovery>"<span>; </span><span>121</span><span> } </span><span>122</span><span>} </span><span>123</span><span>124</span> ?>
The above has introduced SoapDiscoveryclassphp, including discovery content. I hope it will be helpful to friends who are interested in PHP tutorials.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools