ZF-4540: Zend_Soap_Autodiscovery and ArrayOf<Type> (typed arrays in wsdl)
Description
I will copy here the request from http://nabble.com/Soap-AutoDiscover-Arrays-of-Obje…, 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' );
$server->handle();
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,
Nico
Comments
Posted by Benjamin Eberlei (beberlei) on 2008-11-01T10:58:06.000+0000
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.
Posted by Alexander Veremyev (alexander) on 2008-11-03T08:46:19.000+0000
Fixed by Benjamin (see comments and commits)
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:15.000+0000
Changing issues in preparation for the 1.7.0 release.