Re: SOAP call with multiple elements in a list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think customer should be array of stdClass objects not class itself.

stdClass customers
{
     customer = array(object1, object2, ..., objectN)
}


where objectN is stdClass which has 2 attributes name and address.


Hope this helps.





----- Original Message -----
From: edmond shabanian <shabanied@gmail.com>
To: soap@lists.php.net
Cc: 
Sent: Wednesday, 31 October 2012, 3:50
Subject: [SOAP] SOAP call with multiple elements in a list

I have a web service that I'm trying to call from PHP using SoapClient for
which I have been supplied a WSDL. Part of the request that I'm supposed to
send is a list.  Example being a list of customers.  The wsdl calls for
something like this:

            <Customers>
               <!--Zero or more repetitions:-->
               <Customer>
                  <Name></Name>
                  <Address></Address>
               <Customer>
            <Customers>

The problem is that there is no way that I'm aware of in PHP to represent
such a list.  If I create an array or a std_class object containing
customer information, each element is indexed, i.e.

Customers = Array[2]
0 = Object
    Customer = Object
          Name = Smith
          Address = Easy St.
1 = Object
     Customer = Obect
     . . . and so on

It seems that PHP enforces a rule where ther must be unique id for reach
element of an array or object.  When I submit this request to SOAP, only
the first element of the Customer object makes it into the request.  I've
seen other posts for similar problems on other boards, but am unclear as to
the best solution, if there really is a solution at all.



-- 
Ed Shabanian

[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux