android - KSOAP2 Parsing complex hierarchy of Response -
i have problem parsing complex response of ksoap2.
my response xml file is:
<word>breadth</word> <definitions> <definition> <word>breadth</word> <dictionary> <id>gcide</id> <name>the collaborative international dictionary of english v.0.44</name> </dictionary> <worddefinition>breadth \breadth\ (br[e^]dth)</worddefinition> </definition> <definition> <word>breadth</word> <dictionary> <id>moby-thes</id> <name>moby thesaurus ii grady ward, 1.0</name> </dictionary> <worddefinition>87 moby thesaurus words "breadth": </worddefinition> </definition> </definitions>
my class file is:
public class mainactivity extends activity { private static final string soap_action = "http://services.aonaware.com/webservices/define"; private static final string namespace = "http://services.aonaware.com/webservices/"; private static final string method_name = "define"; private static final string url = "http://services.aonaware.com/dictservice/dictservice.asmx"; int n=0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); soapobject request = new soapobject(namespace,method_name); propertyinfo pi1=new propertyinfo(); pi1.setname("word"); pi1.setvalue("breadth"); pi1.settype(string.class); request.addproperty(pi1); soapserializationenvelope soapenvelope = new soapserializationenvelope(soapenvelope.ver11); soapenvelope.dotnet=true; soapenvelope.setoutputsoapobject(request); httptransportse androidhttptransport =new httptransportse(url); try{ androidhttptransport.call(soap_action, soapenvelope); soapobject resultans = (soapobject)soapenvelope.getresponse(); system.out.println("full ans: "+resultans); } catch(exception e){ e.printstacktrace(); } }
my output on logcat is:
here 1: anytype{word=breadth; definitions=anytype{definition=anytype{word=breadth; dictionary=anytype{id=gcide; name=the collaborative international dictionary of english v.0.44; }; worddefinition=breadth \breadth\ (br[e^]dth) ; }; definition=anytype{word=breadth; dictionary=anytype{id=moby-thes; name=moby thesaurus ii grady ward, 1.0; }; worddefinition=87 moby thesaurus words "breadth": ; }; }; }
i have been searching 2 days.. still not able parse it. , new ksoap2.. dont know proper way parse complex objects. can tell me how did values it?
edit:i don't have trouble connection, want know data xml nodes, problem xml has node inside of node. think actual effort starts soupenvelope.getresopnse()
line. plz!
Comments
Post a Comment