:: how to parse KSOAP ARRAYTPE response ::
I need some help in understanding how to parse the KSOAP RESPONSE in j2me. below is the actual ksoap response i get after making a ksoap request.
<AddressArray>
<AddressBin>
<UserSeqID>200</UserSeqID>
<AddressID>115</AddressID>
<ZipCode>10005</ZipCode>
<IsPrimary>false</IsPrimary&g开发者_JAVA技巧t;
<State>New York</State>
<StateID>37</StateID>
<StateCode>NY</StateCode>
<City>New York Mills village</City>
<CityID>11701</CityID>
<StreetAddress>90 feet rd</StreetAddress>
<NickName>Gym</NickName>
</AddressBin>
<AddressBin>
<UserSeqID>200</UserSeqID>
<AddressID>110</AddressID>
<ZipCode>10002</ZipCode>
<IsPrimary>false</IsPrimary>
<State>New York</State>
<StateID>37</StateID>
<StateCode>NY</StateCode>
<City>New York city</City>
<CityID>11700</CityID>
<StreetAddress>5th Street</StreetAddress>
<NickName>Home</NickName>
</AddressBin>
<AddressBin>
<UserSeqID>200</UserSeqID>
<AddressID>114</AddressID>
<ZipCode>10002</ZipCode>
<IsPrimary>true</IsPrimary>
<State>New York</State>
<StateID>37</StateID>
<StateCode>NY</StateCode>
<City>New York city</City>
<CityID>11700</CityID>
<StreetAddress>4th Street</StreetAddress>
<NickName>Office</NickName>
</AddressBin>
</AddressArray>
here is the ksoap response template
<AddressArray>
<AddressBin>
<UserSeqID>int</UserSeqID>
<AddressID>int</AddressID>
<ZipCode>string</ZipCode>
<IsPrimary>boolean</IsPrimary>
<State>string</State>
<StateID>int</StateID>
<StateCode>string</StateCode>
<City>string</City>
<CityID>int</CityID>
<StreetAddress>string</StreetAddress>
<NickName>string</NickName>
</AddressBin>
<AddressBin>
<UserSeqID>int</UserSeqID>
<AddressID>int</AddressID>
<ZipCode>string</ZipCode>
<IsPrimary>boolean</IsPrimary>
<State>string</State>
<StateID>int</StateID>
<StateCode>string</StateCode>
<City>string</City>
<CityID>int</CityID>
<StreetAddress>string</StreetAddress>
<NickName>string</NickName>
</AddressBin>
</AddressArray>
please let me know how should i map the soap xml respone to custom java classes ?
I don't know how it works in J2ME, but what I did with Android was to run a loop the size of the PropertyCount(which in your case would be the PropertyCount of AddressArray) of the SOAP response, access every individual property of that (your case AddressBin) while in the loop, and then again access every property of that property (your case UserSeqID, AddressID, etc.), put them into a String, parse those to the desired variables and put those variables in a model and put those models in an array.
If you want them to be automatically serialized I can't help you with that because I don't know how that works.
Hope this helps.
精彩评论