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
没有评论:
发表评论