View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Soap_AutoDiscover
{zone-data}

{zone-data:proposer-list}
[Renan de Lima|mailto:renandelima@gmail.com]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 11 May 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Adding complex array structure to WSDL generated by Zend_Soap_Wsdl and Zend_Soap_AutoDiscover.

Some people use WSDL as the webservice API documentation. WSDL that shows just "array" as input or output request doesn't help the client side team. This proposal may provide additional information to WSDL when server side wants to work with array. The major goal is to answer the commom question: what does this array contain? an integer? an string?
{zone-data}

{zone-data:references}
* [http://www.w3.org/2002/ws/databinding/edcopy/advanced/advanced.html#pattern-SOAPEncodedArray]
* [http://www.w3.org/2002/ws/databinding/examples/6/09/SOAPEncodedArray/]
* [http://www.w3.org/TR/wsdl#_types]
{zone-data}

{zone-data:requirements}
* This proposal must provides an easy way to declare multi-dimensional arrays in webservices classes
* Current Zend_Soap_AutoDiscover and Zend_Soap_Wsdl behavior still must work for "@param array" and "@return array"
{zone-data}

{zone-data:dependencies}
No dependency.
{zone-data}

{zone-data:operation}
Users just will have to use new documentation style into their webservices classes.
{zone-data}

{zone-data:milestones}
* Milestone 1: design
* Milestone 2: tests
* Milestone 3: documentation
{zone-data}

{zone-data:class-list}
No new class is necessary.
{zone-data}

{zone-data:use-cases}
||UC-01 classic usage||
{code}
<?php
/**
* @param integer[]
* @return void
*/
public function xxx(array $number){}

/**
* @param array of integer
* @return void
*/
public function xxx(array $number){}
{code}

WSDL must contain in "message" part:

{code}
<message name="xxxRequest">
<part name="yyy" type="tns:arrayOfInteger"/>
</message>
{code}

WSDL must contain in "types" part:
{code}
<xsd:complexType name="ArrayOfInteger">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" arrayType="tns:integer[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
{code}

||UC-02 multiple array||
{code}
<?php
/**
* @param integer[][]
* @return void
*/
public function xxx(array $number){}

/**
* @param array of array of integer
* @return void
*/
public function xxx(array $number){}
{code}

WSDL must contain in "message" part:
{code}
<message name="__SOME_MESSAGE_NAME__">
<part name="__SOME_PART_NAME__" type="tns:ArrayOfArrayOfInteger"/>
</message>
{code}

WSDL must contain in "types" part:
{code}
<xsd:complexType name="ArrayOfInteger">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" arrayType="tns:integer[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ArrayOfArrayOfInteger">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" arrayType="tns:ArrayOfInteger[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
{code}

||UC-03 multiple array together complex type||
{code}
<?php
/**
* @param MyClass[][]
* @return void
*/
public function xxx(array $number){}
{code}

WSDL must contain in "message" part:
{code}
<message name="__SOME_MESSAGE_NAME__">
<part name="__SOME_PART_NAME__" type="tns:arrayOfArrayOfMyClass"/>
</message>
{code}

WSDL must contain in "types" part:
{code}
<xsd:complexType name="MyClass">
<xsd:all>
...
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ArrayOfMyClass">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" arrayType="tns:MyClass[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ArrayOfArrayOfMyClass">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" arrayType="tns:arrayOfMyClass[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
{code}
{zone-data}

{zone-data:skeletons}
No new class is necessary, zf core team have to change Zend_Soap_Wsdl and Zend_Soap_AutoDiscover internal methods.
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>