Zend Framework

Zend_Soap_Autodiscovery and ArrayOf<Type> (typed arrays in wsdl)

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.6.1
  • Fix Version/s: 1.7.0
  • Component/s: Zend_Soap_Wsdl
  • Labels:
    None

Description

I will copy here the request from http://www.nabble.com/Soap-AutoDiscover-Arrays-of-Objects--td18709067.html#a19913480, 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":

<xsd:complexType name="ArrayOfData">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="typens:Data[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="Data">
<xsd:all>
<xsd:element name="dummy" type="xsd:int" />
</xsd:all>
</xsd:complexType>

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

Issue Links

Activity

Hide
Benjamin Eberlei added a comment -

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.

Show
Benjamin Eberlei added a comment - 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.
Hide
Alexander Veremyev added a comment -

Fixed by Benjamin (see comments and commits)

Show
Alexander Veremyev added a comment - Fixed by Benjamin (see comments and commits)
Hide
Wil Sinclair added a comment -

Changing issues in preparation for the 1.7.0 release.

Show
Wil Sinclair added a comment - Changing issues in preparation for the 1.7.0 release.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: