|
|
@@ -439,63 +439,4 @@ $soapMyClassType = $wsdl->getType('MyClass');
|
|
|
</para>
|
|
|
</sect2>
|
|
|
|
|
|
- <sect2 id="zend.soap.wsdl.parser">
|
|
|
- <title>Parsing WSDL documents</title>
|
|
|
-
|
|
|
- <para>
|
|
|
- <classname>Zend_Soap_Wsdl</classname> also contains a parser for WSDL documents that has its main application in unit-testing and code-generation
|
|
|
- for <acronym>SOAP</acronym> Webservices (Client and Server). The following example will show how the Parser can be used:
|
|
|
- </para>
|
|
|
-
|
|
|
- <programlisting language="php"><![CDATA[
|
|
|
-// Load WSDL into DOMDocument
|
|
|
-$dom = new DOMDocument();
|
|
|
-$dom->loadXML($wsdlString);
|
|
|
-
|
|
|
-// Create parser
|
|
|
-$parser = Zend_Soap_Wsdl_Parser::factory($dom);
|
|
|
-$result = $parser->parse();
|
|
|
-
|
|
|
-// Webservice Name
|
|
|
-echo $result->getName();
|
|
|
-
|
|
|
-// Access Ports and inner elements
|
|
|
-foreach($result->ports AS $port) {
|
|
|
- echo $port->getName();
|
|
|
- foreach($port->bindings AS $binding) {
|
|
|
- echo $binding->getName();
|
|
|
-
|
|
|
- foreach($binding->operations AS $operation) {
|
|
|
- echo $operation->getName();
|
|
|
- echo $operation->inputMessage->getName();
|
|
|
- echo $operation->outputMessage->getName();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-// You can access bindings, messages and operations
|
|
|
-// and other elements directly too
|
|
|
-foreach($result->operations AS $operation) {
|
|
|
- // do stuff
|
|
|
-}
|
|
|
-foreach($result->bindings AS $binding {
|
|
|
- // do stuff
|
|
|
-}
|
|
|
-foreach($result->messages AS $message) {
|
|
|
- // do stuff
|
|
|
-}
|
|
|
-foreach($result->services AS $service) {
|
|
|
- // do stuff
|
|
|
-}
|
|
|
-foreach($result->types AS $type) {
|
|
|
- // do stuff
|
|
|
-}
|
|
|
-]]></programlisting>
|
|
|
-
|
|
|
- <para>All elements implement the interface <classname>Zend_Soap_Wsdl_Element_Interface</classname>
|
|
|
- that proxies a <methodname>getName()</methodname> and a <methodname>getDocumentation()</methodname> function with the
|
|
|
- unique identifier of the element and its documentation respectively. All the elements have
|
|
|
- public properties that describe its state in more detail and also contain their nested
|
|
|
- dependencies for easy iteratable access.</para>
|
|
|
- </sect2>
|
|
|
-
|
|
|
</sect1>
|