Soap <element maxOccurs="unbounded"> getting overridden
Posted on 2011-09-16
I have a very complex structure to build via PHP and SOAP. I am using an stdObject to build the complex params and then pass them on to the Soap call. Everything was working fine until I needed to add multiple elements of the same complex type. This is giving me problems as they are being overridden.
Complex Type :-
<element name="numDettagliBonusSaldo" type="byte"/>
<element maxOccurs="unbounded" minOccurs="0" name="dettaglioBonusSaldo" type="tns:DettaglioBonus"/>
where DettaglioBonus is :-
<element name="famigliaGioco" type="byte"/>
<element name="tipoGioco" type="byte"/>
<element name="importo" type="int"/>
The problem is when I first create the complex type using e.g. :-
$complex_type->famigliaGioco = 1;
Then I go to include the complex type to the rest of the elements and the second complex type replaces the first one.
$tmp->dettaglioBonusSaldo = $complex_type;
Could you kindly help? I am really stuck.
Modification of the xsd is not possible as I need to follow a very strict protocol.