I am building a web service using the Zend Framework. I am using the Zend_Soap_AutoDiscover class for the generation of my WSDL. I am using various complex type in this web service form example:
StockItemEntity Class
class StockItemEntity {
/** @var string */
public $sStockCode;
/** @var string */
public $sQty;
public function __construct($sStockCode, $sQty){
$this->sStockCode = $sStockCode;
$this->sQty = $sQty;
}
}
WSDL Definition
<xsd:complexType name="StockItemEntity">
<xsd:all>
<xsd:element name="sStockCode" type="xsd:string" nillable="true"/>
<xsd:element name="sQty" type="xsd:string" nillable="true"/>
</xsd:all>
</xsd:complexType>
From what I understood from reading over the web the nillable="true" is there because properties of any object can be set to null. Thus the nillable="true" is need to maintain a valid XML document even if the StockItemEntity object has all its properties set to null.
My concern is that those two properties must always be passed to the web method. Is it possible to remove the "nillable=true" to sort of force the properties not to be null? Or else is there any way to force non null values in those properties. I was hoping to avoid having to validate them on the webservice side.
Thanks
Kind Regards
Gabriel