Re: nested object in SOAP result

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

 



On 8 September 2010 16:08, Richard Quadling <rquadling@gmail.com> wrote:
> On 8 September 2010 15:43, nik600 <nik600@gmail.com> wrote:
>> On Wed, Sep 8, 2010 at 2:50 PM, Richard Quadling <rquadling@gmail.com> wrote:
>>> On 8 September 2010 11:25, nik600 <nik600@gmail.com> wrote:
>>>> On Wed, Sep 8, 2010 at 12:10 PM, Richard Quadling <rquadling@gmail.com> wrote:
>>>>> On 7 September 2010 19:12, nik600 <nik600@gmail.com> wrote:
>>>>>>
>>>>
>>>
>>> Scalar or Struct - that's the choice. An "array" is a struct.
>>>
>>> You are supplying an array of attributes.
>>>
>>> The struct is the array.
>>>
>>> Nothing is actually wrong.
>>>
>>>
>>> --
>>> Richard Quadling
>>> Twitter : EE : Zend
>>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>>
>>
>> Ok, but on server-side i can do
>>
>> foreach($Element->Elements as $v){
>> // process Element $v
>> }
>>
>> and on client-side i have to do
>>
>> foreach($Element->Elements->Struct as $v){
>> // process Element $v
>> }
>>
>>
>> --
>> /*************/
>> nik600
>> http://www.kumbe.it
>>
>
> Yep!
>
> That's what your WSDL says it is.
>
> ElementA contains PropertyA1 and Elements (of type ElementB)
> ElementB is an array of PropertyB1s
>
> ElementA->Elements->ElementB->PropertyB1
>
> The array is a construct in its own right.
>
> http://search.cpan.org/~rybskej/SOAP-Data-ComplexType-0.044/lib/SOAP/Data/ComplexType.pm#Using_arrays_and_Array_type_fields
> gives some more info on this.
>
> The "array" isn't part of this WSDL file, so it is just a structure
> and no dereferencing ( Elements->ElementB->PropertyB1 =>
> Elements->PropertyB1) (Don't know the exact terminology).
>
>
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>

>From one of my services ...

<definitions
 name="***************"
 targetNamespace="************"
 xmlns="http://schemas.xmlsoap.org/wsdl/";
 xmlns:tns="************"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
 xmlns:xsd="http://www.w3.org/2001/XMLSchema";
 xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/";
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
	<types>
		<xsd:schema targetNamespace="*************">
			<xsd:complexType name="ArrayOfCustomer_V1_0">
				<xsd:complexContent>
					<xsd:restriction base="soap-enc:Array">
						<xsd:attribute ref="soap-enc:arrayType"
wsdl:arrayType="tns:Customer_V1_0[]"/>
					</xsd:restriction>
				</xsd:complexContent>
			</xsd:complexType>
			<xsd:complexType name="Customer_V1_0">
				<xsd:all>
					<xsd:element name="UniqueID" type="xsd:int" nillable="true"/>
					<xsd:element name="Customer" type="xsd:string" nillable="true"/>
					<xsd:element name="DateAdded" type="xsd:dateTime" nillable="true"/>
					<xsd:element name="DateRemoved" type="xsd:dateTime" nillable="true"/>
				</xsd:all>
			</xsd:complexType>
			<xsd:complexType name="Customers_V1_0">
				<xsd:all>
					<xsd:element name="Customers" type="tns:ArrayOfCustomer_V1_0"/>
				</xsd:all>
			</xsd:complexType>
...

It seems SOAPClient understands soap-enc:Array / soap-enc:arrayType
and so my usage is ...

foreach($Results->Customers as $o_Customer) {
 echo $o_Customer->UniqueID, $o_Customer->Customer, date('r',
$o_Customer->DateAdded'), PHP_EOL;
}

sort of thing.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

  Powered by Linux