Solved

Soap <element maxOccurs="unbounded"> getting overridden

Posted on 2011-09-16
1
1,078 Views
Last Modified: 2012-08-14
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 :-

<complexType name="DettaglioBonus">
      <sequence>
            <element name="famigliaGioco" type="byte"/>
            <element name="tipoGioco" type="byte"/>
            <element name="importo" type="int"/>
      </sequence>
</complexType>

The problem is when I first create the complex type using e.g. :-

$complex_type->famigliaGioco = 1;
$complex_type->tipoGioco= 1;
$complex_type->importo= 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.
0
Comment
Question by:drinu78
1 Comment
 

Accepted Solution

by:
drinu78 earned 0 total points
ID: 36548186
I found the solution :-

I had to do :-

$tmp->dettaglioBonusSaldo[0] = $complex_type;
$tmp->dettaglioBonusSaldo[1] = $complex_type;
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now