ZF-4688: Invalid WSDL when more then one prototype is given for any reflected function


Zend_Soap_Wsdl generates an invalid WSDL document when used with Zend_Soap_AutoDiscover and a class or function that has more than one prototype for a call. That means, if any variable has a default value in a method/function definition like "function foo($a=1) { }" it produces two request and response messages which is invalid WSDL. I am no wsdl guru at all but php SOAPServer dies with a fatal error saying "multiple response (request) messages with the same name".



require_once "Zend/Loader.php"; Zend_Loader::registerAutoload();

class MyMultiplyService { /** * Hello multiply * * @param int $a * @param int $b * @return int / public function multiply($a=1, $b=1) { return $a$b; } }

$autodiscover = new Zend_Soap_AutoDiscover(); $autodiscover->setClass('MyMultiplyService'); $autodiscover->handle(); {/quote}

Consume the generated WSDL with:

{quote}$server = new SOAPServer('uri/to/wsdl');{/quote}


Fixed in trunk, with the following important note:

Each method has one or more prototypes depending on the given parameter types or default values of the variables. In the status pre Revision 12132 the AutoDiscover would built operations for each of this prototypes which is invalid behaviour. SOAP can only handle one prototype per function except when they are renamed and forwarded. This cannot be depicted by AutoDiscover since it would lead to operations called xyz1(), xyz2() and so forth.

What AutoDiscover now does is the following: It searches for the prototypes with the largest number of parameters for each class method and uses this one for WSDL Generation. If multiple prototypes are found with the largest parameter number the first one will be picked.

Changing issues in preparation for the 1.7.0 release.