Kaynağa Gözat

Zend_Soap: fix WSDL generation addBindingOperation() fault processing. Fixes [ZF-10625].

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23341 44c647ce-9c0f-0410-b52a-842ac1e357ba
alexander 15 yıl önce
ebeveyn
işleme
f0ceef8158
2 değiştirilmiş dosya ile 11 ekleme ve 5 silme
  1. 8 2
      library/Zend/Soap/Wsdl.php
  2. 3 3
      tests/Zend/Soap/WsdlTest.php

+ 8 - 2
library/Zend/Soap/Wsdl.php

@@ -317,11 +317,17 @@ class Zend_Soap_Wsdl
 
         if (is_array($fault)) {
             $node = $this->_dom->createElement('fault');
+            /**
+             * Note. Do we really need name attribute to be also set at wsdl:fault node???
+             * W3C standard doesn't mention it (http://www.w3.org/TR/wsdl#_soap:fault)
+             * But some real world WSDLs use it, so it may be required for compatibility reasons.
+             */
             if (isset($fault['name'])) {
                 $node->setAttribute('name', $fault['name']);
             }
-            $soap_node = $this->_dom->createElement('soap:body');
-            foreach ($output as $name => $value) {
+
+            $soap_node = $this->_dom->createElement('soap:fault');
+            foreach ($fault as $name => $value) {
                 $soap_node->setAttribute($name, $value);
             }
             $node->appendChild($soap_node);

+ 3 - 3
tests/Zend/Soap/WsdlTest.php

@@ -204,7 +204,7 @@ class Zend_Soap_WsdlTest extends PHPUnit_Framework_TestCase
                                    'operation3',
                                    array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"),
                                    array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"),
-                                   array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/")
+                                   array('name' => 'MyFault', 'use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/")
                                    );
 
         $this->assertEquals($this->sanitizeWsdlXmlOutputForOsCompability($wsdl->toXml()),
@@ -234,8 +234,8 @@ class Zend_Soap_WsdlTest extends PHPUnit_Framework_TestCase
                                .     '<output>'
                                .       '<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>'
                                .     '</output>'
-                               .     '<fault>'
-                               .       '<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>'
+                               .     '<fault name="MyFault">'
+                               .       '<soap:fault name="MyFault" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>'
                                .     '</fault>'
                                .   '</operation>'
                                . '</binding>'