Re: SOAP call with multiple elements in a list

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

 



If your WSDL file is correct, then I would strongly recommend using a
wsdl2php script to create the local client classes which wrap up a large
amount of the complexity for you.

Normally, you will have 2 classes for this situation. 1 is the "customer'
(name/address) and the other is "customers" (array of customer).




On 30 October 2012 23:41, NAVEEN <naveenkr2001@yahoo.com> wrote:

> 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 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
>



-- 
Richard Quadling
Twitter : EE : Zend : Fantasy Shopper
@RQuadling : http://e-e.com/M_248814.html : http://bit.ly/9O8vFY :
http://fan.sh/106/5tw

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

  Powered by Linux