java - PI must not start with xml -


    //initialize soap request       soapobject request = new soapobject(namespace, method_name);      //use add parameters     request.addproperty("agentcode",agentcode);     request.addproperty("pincode",agentcodepin);     request.addproperty("appversion",appversion);     request.addproperty("deviceid",deviceid);     request.addproperty("latitude",latitude);     request.addproperty("longitude",longitude);    //declare version of soap request     soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11);      envelope.setoutputsoapobject(request);      envelope.dotnet = true;      try {          httptransportse androidhttptransport = new httptransportse(url);          //this actual part call web service         androidhttptransport.call(soap_action, envelope);          // soapresult envelope body.         soapobject result = (soapobject)envelope.bodyin;           if(result != null)         {               documentbuilderfactory factory = documentbuilderfactory.newinstance();              factory.setnamespaceaware(true);               documentbuilder builder = factory.newdocumentbuilder();               inputsource = new inputsource();              is.setcharacterstream(new stringreader( result.tostring()));               org.w3c.dom.document doc = builder.parse(is);               doc.getdocumentelement().normalize();             //get node list              nodelist nlist = doc.getelementsbytagname("paypoint");             //get node              node nnode = (node) nlist.item(0);              if (nnode.gettype(0) == node.element)             {                 //get element                 element elt = (element) nnode;                   // token                 this.token = elt.getelementsbytagname("token").item(0).gettextcontent();                 // flag                 this.flag = elt.getelementsbytagname("statuscode").item(0).gettextcontent();                 // agent name                 this.agentname = elt.getelementsbytagname("fullname").item(0).gettextcontent();             }              }           } catch (exception e)           {                 throw e;           }          return this.flag; 

i having problem @ line: is.setcharacterstream(new stringreader( result.tostring()));

the error : pi must not start xml ( portion: unknown xml@1:30 in java.io.stringreader@40579f48)

my xml file this:

<string xmlns="http://tempuri.org/"> <?xml version="1.0" encoding="utf-16"?><paypoint> <token>pksmttulandnmm9r4vmi+qrwtchw/xs61sperotpb5eegrfrqkui6r2rqlqnusvjpvj1ozbc8z0=</token>   <statuscode>1</statuscode><statustext>valid user</statustext><fullname>dao    lacina</fullname><walletbalance>2000.00</walletbalance></paypoint> 

any help

<?xml version="1.0" encoding="utf-16"?> must first line of xml document. try instead :

<?xml version="1.0" encoding="utf-16" ?> <string xmlns="http://tempuri.org/"> <paypoint>  <token>pksmttulandnmm9r4vmi+qrwtchw/xs61sperotpb5eegrfrqkui6r2rqlqnusvjpvj1ozbc8z0=</token>    <statuscode>1</statuscode> <statustext>valid user</statustext> <fullname>dao    lacina</fullname> <walletbalance>2000.00</walletbalance> </paypoint> </string> 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -