android - cant parse xml using a KSOAP2 -


i have connected asp.net service using ksoap2 , connects fine, 1 thing response in xml. there anyway can display in normal text.

this code have used

public class androidwebservice extends activity {  /** called when activity first created. */ private static string soap_action = "http://tempuri.org/gethelpdeskcalls"; private static string namespace = "http://tempuri.org/"; private static string method_name = "gethelpdeskcalls"; static final string url = "https://198.125.364:8080/androidservices/service1.asmx";  button getdata; edittext userid; textview data;  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.helpdesk);      getdata = (button) findviewbyid(r.id.button1);     userid = (edittext) findviewbyid(r.id.txtfar);     data = (textview) findviewbyid(r.id.textview1);      thread nt = new thread() {         @override         public void run() {              getdata.setonclicklistener(new view.onclicklistener() {                  @override                 public void onclick(view v) {                      soapobject request = new soapobject(namespace,                             method_name);                      request.addproperty("userid", userid.gettext()                             .tostring());                      soapserializationenvelope envelope = new soapserializationenvelope(                             soapenvelope.ver11);                      envelope.setoutputsoapobject(request);                     envelope.dotnet = true;                      envelope.setoutputsoapobject(request);                      try {                         httptransportse androidhttptransport = new httptransportse(                                 url);                          // androidhttptransport.call(soap_action, envelope);                         androidhttptransport.debug = true;                         androidhttptransport.call(soap_action, envelope);                         final string ss = androidhttptransport.responsedump;                          // final soapobject response = (soapobject) envelope                         // .getresponse();                          runonuithread(new runnable() {                             public void run() {                                   data.settext(ss.tostring());                             }                          });                      } catch (exception e) {                          data.settext("error");                     }                 }              });          }      };     nt.start(); } 

}

there neat website called google, wonders.

since seem lazy there 3 basic xml parsing methods can use

sax parser, dom parser, xml pull parser

read xml parsing here


Comments