ZF-4125: Zend_Soap_Autodiscover/Zend_Soap_Wsdl replicates request messages for methods with multiple return types

Description

As of SVN rev 11146, when Zend_Soap_Autodiscover::setClass() is called and passed the name of a class with the following method declaration..,

/**
* @param string $id
* @return array|null Column-value pairs or NULL if the record is not
*         found
*/
public function retrieve($id)
{
        ...
    return $row ? $row : null;
}

... the resulting WSDL contains multiple identical retrieveRequest messages, one for each potential return type...


The reason for this appears to be that neither Zend_Soap_Autodisover::setClass() nor Zend_Soap_Wsdl::addMessage() check to ensure that a message being added isn't identical to one that was previously added. Pointing Zend_Soap_Client_Local to this WSDL results in this error: "SoapFault: SOAP-ERROR: Parsing WSDL: 'retrieveRequest' already defined."

Comments

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.