ZF-4540: Zend_Soap_Autodiscovery and ArrayOf<Type> (typed arrays in wsdl)


I will copy here the request from…, because it decribes everything:

Hi all!

First of all I really appreciate the new Soap Autodiscover-feature.

I'm missing one thing, though (tried 1.6 rc1):

I'd like to use arrays of objects.

class MyService { /** * my class * * @return Data[] */ public function getArrayOfObjects() { $return = array(); $return[] = new Data(); $return[] = new Data();

 return $return;



class Data { /** * @var int * */ $dummy = 5; }

$server = new Zend_Soap_AutoDiscover(); $server->setClass( 'Service' );


Now if I have a look at the generated wsdl, the function getArrayOfObjects just has output "xsd:anyType". If I change "Data[]" to "array", then it becomes "soap-enc:Array". To my mind, it would be nice, to generate a complex type "ArrayOfData":

This way, the PEAR Services/Webservice Class used to generate the wsdl.

Another option could be to generate a container complex type with the inner type set to minOccurs="1" maxOccurs="unbounded" to get an array.

I don't think php has any problems accessing a service with an "xsd:any" array, but there are other languages that are much more strict on that point.

Any ideas? Any plans in these directions? greetings,



This is now fixed in trunk, i cannot change the status to resolved though, since there is a bug in Jira.

There is a new WSDL complex type detection strategy class "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex" which handles the case of returning Arrays of Objects.

Fixed by Benjamin (see comments and commits)

Changing issues in preparation for the 1.7.0 release.