chamonix Posted May 18, 2011 Share Posted May 18, 2011 Hi, i have a wierd problem with SOAP. My soap response doesn't list my nested array properly This is the WSDL (XML shortened): ----------------8<-------------------- <xsd:complexType name="ShowDispoResult"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ListLanguageDetails[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="ListLanguageDetails"> <xsd:all> <xsd:element name="id_lang" type="xsd:int" minOccurs="0"/> <xsd:element name="lang" type="xsd:string" minOccurs="0"/> <xsd:element name="places" type="typens:ListPlaces" minOccurs="0"/> </xsd:all> </xsd:complexType> <xsd:complexType name="ListPlaces"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ShowDispoDetails[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="ShowDispoDetails"> <xsd:all> <xsd:element name="nom_place" type="xsd:string" minOccurs="0"/> <xsd:element name="dispo_type" type="xsd:string" minOccurs="0"/> </xsd:all> </xsd:complexType> ----------------8<-------------------- This is my array ----------------8<-------------------- Array ( [0] => Array ( [id_lang] => 1 [lang] => Français [places] => Array ( [0] => Array ( [nom_place] => Chambre 1 personne [dispo_type] => Prix par nuit à la nuitée ) [1] => Array ( [nom_place] => Chambre 3 personnes [dispo_type] => Prix par nuit à la nuitée ) ) ) [1] => Array ( [id_lang] => 2 [lang] => English [places] => Array ( [0] => Array ( [nom_place] => Chambre 1 personne [dispo_type] => Prix par nuit à la nuitée ) [1] => Array ( [nom_place] => Chambre 3 personnes [dispo_type] => Prix par nuit à la nuitée ) ) ) [2] => Array ( [id_lang] => 3 [lang] => Italiano [places] => Array ( [0] => Array ( [nom_place] => Chambre 1 personne [dispo_type] => Prix par nuit à la nuitée ) [1] => Array ( [nom_place] => Chambre 3 personnes [dispo_type] => Prix par nuit à la nuitée ) ) ) ) ----------------8<-------------------- This is the result I get (XML shortened): ----------------8<-------------------- <ns1:ShowDispoResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <rpc:result>return</rpc:result> <return enc:itemType="ns1:ListLanguageDetails" enc:arraySize="3" xsi:type="ns1:ShowDispoResult"> <item xsi:type="ns1:ListLanguageDetails"> <id_lang xsi:type="xsd:int">1</id_lang> <lang xsi:type="xsd:string">Français</lang> <places enc:itemType="ns1:ShowDispoDetails" enc:arraySize="2" xsi:type="ns1:ListPlaces"> <item xsi:type="ns1:ShowDispoDetails" enc:id="ref1"> <nom_place xsi:type="xsd:string">Chambre 1 personne</nom_place> <dispo_type xsi:type="xsd:string">Prix par nuit à la nuitée</dispo_type> </item> <item xsi:type="ns1:ShowDispoDetails" enc:id="ref2"> <nom_place xsi:type="xsd:string">Chambre 3 personnes</nom_place> <dispo_type xsi:type="xsd:string">Prix par nuit à la nuitée</dispo_type> </item> </places> </item> <item xsi:type="ns1:ListLanguageDetails"> <id_lang xsi:type="xsd:int">2</id_lang> <lang xsi:type="xsd:string">English</lang> <places enc:itemType="ns1:ShowDispoDetails" enc:arraySize="2" xsi:type="ns1:ListPlaces"> <item enc:ref="#ref1" /> <item enc:ref="#ref2" /> </places> </item> <item xsi:type="ns1:ListLanguageDetails"> <id_lang xsi:type="xsd:int">3</id_lang> <lang xsi:type="xsd:string">Italiano</lang> <places enc:itemType="ns1:ShowDispoDetails" enc:arraySize="2" xsi:type="ns1:ListPlaces"> <item enc:ref="#ref1" /> <item enc:ref="#ref2" /> </places> </item> </return> </ns1:ShowDispoResponse> ----------------8<-------------------- It doesn't repeat the "ShowDispoDetails" even if it says arraySize = 2. I'm not sure where the error lays here. Either the WSDL is wrong, w or my array isn't. Quote Link to comment https://forums.phpfreaks.com/topic/236748-soap-with-array-wrong-result/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.