Note that there are some explanatory texts on larger screens.

plurals
  1. POPI must not start with xml
    text
    copied!<pre><code> //Initialize soap request SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //Use this to 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 the version of the SOAP request SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); envelope.dotNet = true; try { HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); //this is the actual part that will call the web service androidHttpTransport.call(SOAP_ACTION, envelope); // Get the SoapResult from the envelope body. SoapObject result = (SoapObject)envelope.bodyIn; if(result != null) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); InputSource is = 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; // Get token this.token = elt.getElementsByTagName("token").item(0).getTextContent(); // Get flag this.flag = elt.getElementsByTagName("statusCode").item(0).getTextContent(); // Get agent name this.agentName = elt.getElementsByTagName("fullname").item(0).getTextContent(); } } } catch (Exception e) { throw e; } return this.flag; </code></pre> <p>I am having problem at this line: is.setCharacterStream(new StringReader( result.toString()));</p> <p>the error is : PI must not start with xml ( portion: unknown xml@1:30 in java.io.stringReader@40579f48)</p> <p>My Xml file look like this:</p> <pre><code>&lt;string xmlns="http://tempuri.org/"&gt; &lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;paypoint&gt; &lt;token&gt;PkSMTTulAndNmM9R4Vmi+QRWtChW/Xs61sPERoTpB5eEgRfrQKUi6r2rqLQNusvJpVJ1oZBc8Z0=&lt;/token&gt; &lt;statusCode&gt;1&lt;/statusCode&gt;&lt;statusText&gt;VALID USER&lt;/statusText&gt;&lt;fullname&gt;Dao Lacina&lt;/fullname&gt;&lt;walletbalance&gt;2000.00&lt;/walletbalance&gt;&lt;/paypoint&gt; </code></pre> <p></p> <p>Any help</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload