How To Parse Diffgram Anytype Response From .net Webservice
I am getting the following response from a .net webservice which is of anytype format.I need to parse this format and read the data value like RemMessage and INVM_ID provided in th
Solution 1:
You have included XML representation of soap response in this post: Parsing Complex Soap Response with diffgram. And there we may see, that first element ("schema = anyType {...") is only a definition of type "NewDataSet". So You need to parse only second part, that holds data for GetReminder models. The code is under Your last posting here https://stackoverflow.com/a/30059614/4114960
Solution 2:
public ArrayList<Object> deserializeSoap(SoapObject soapObj) {
if(soapObj!=null){
if(soapObj.hasProperty("GetReminderResult")){
SoapObject SoapObj1 = (SoapObject) soapObj.getProperty("GetReminderResult");
if(soapObj1.hasProperty("schema")){
SoapObject soapObj2 = (SoapObject) soapObj1.getProperty("schema");
if(soapObj2.hasProperty("element")){
SoapObject SoapObj3 = (SoapObject) soapObj2.getProperty("element");
if(SoapObj3.hasProperty("complexType")){
SoapObject SoapObj4 = (SoapObject) SoapObj3.getProperty("complexType");
if(SoapObj4.hasProperty("choice")){
SoapObject SoapObj5 = (SoapObject) SoapObj4.getProperty("choice");
if(SoapObj5.hasProperty("element")){
SoapObject SoapObj6 = (SoapObject) SoapObj5.getProperty("element");
if(SoapObj6.hasProperty("sequence")){
SoapObject SoapObj7 = (SoapObject) SoapObj6.getProperty("sequence");
if(SoapObj7.hasProperty("element"))
{
getListFromSoapObj(SoapObj7)
}
}
}
}
}
}
}
}
}
return null;
}
private static ArrayList<Object> getListFromSoapObj(SoapObject soapObj) {
ArrayList<Object> memberObjList = new ArrayList<Object>();
for (int i = 0; i < soapObj.getPropertyCount(); i++) {
Object memberObj = new Object();
SoapObject soapObjectInner = (SoapObject) soapObj.getProperty(i);
if (soapObjectInner.hasProperty("RemMessage")) {
memberObj.setImageId(soapObjectInner
.getPropertyAsString("RemMessage"));
}
memberObjList.add(memberObj);
}
return memberObjList;
System.out.println("---------------------" + memberObjList.size());
}
Post a Comment for "How To Parse Diffgram Anytype Response From .net Webservice"