I need to receive from client an XML input like this (with 2 or more elements):
<list>
<item>
<code xsi:type="xsd:string">123</code>
<product xsi:type="xsd:string">hello</product>
<level xsi:type="xsd:float">3</level>
</item>
<item>
<code xsi:type="xsd:string">1234</code>
<product xsi:type="xsd:string">hello2</product>
<level xsi:type="xsd:float">4</level>
</item>
</list>
May I define a complexType like this to describe input parameter for service method (using an array(array(...)?
$server->wsdl->addComplexType( 'name', 'complexType', 'struct', 'all', '', array (array ( 'code' => array('name' => 'code', 'type' => 'xsd:string'), 'product' => array('name' => 'product', 'type' => 'xsd:string'), 'level' => array('name' => 'level', 'type' => 'xsd:float') )) );
$server->register('updateCode', // method name array('name' => 'tns:name'), // input parameters array('return' => 'xsd:string'), // output parameters 'urn:updateCode', // namespace 'urn:updatecode#updateCode', // soapaction 'rpc', // style 'encoded' // use ); function updateCode($input){ return count($input); }
When I use an XML with 2 items, I obtain 2 as response; when I use an XML with only 1 item, I obtain 3 as response (LIKE THE NUMBER OF THE FIELDS OF EACH ITEM), where I expected 1 as result.
I don't understand why this occurs.
Thanks,