Note that there are some explanatory texts on larger screens.

plurals
  1. POExpecting Nested XML structure but receiving SOAP structure
    primarykey
    data
    text
    <p>I'm making an app that is requesting data from a Web Service (implementing Soap).</p> <p><strong>People who are viewing this pleaase post doubts in comments... I havent got any response to the question do ask me if there is any doubts, i really need help, am stuck!!</strong></p> <p>So to make request I have to use ksoap libraries.. the Web service is <strong>coded to return a response of type XML</strong>. When the web service itself is tested on a browser it displays a result which is as follows: </p> <pre><code>?xml version="1.0" encoding="utf-8" ?&gt; - &lt;SOBKeyList&gt; - &lt;Key&gt; &lt;value&gt;12686&lt;/value&gt; &lt;/Key&gt; - &lt;Key&gt; &lt;value&gt;16238&lt;/value&gt; &lt;/Key&gt; - &lt;Key&gt; &lt;value&gt;26978&lt;/value&gt; &lt;/Key&gt; &lt;/SOBKeyList&gt; </code></pre> <p>clearly an <strong>XML</strong> file...</p> <p><code>However</code> when i use ths code to get a result:</p> <pre><code> public String getXmlFromUrl(String url) { // TODO Auto-generated method stub String xml = null; SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME); PropertyInfo pi = new PropertyInfo(); pi.setName("fkey"); pi.setValue(0); pi.setType(Integer.class); request.addProperty(pi); pi = new PropertyInfo(); pi.setName("tkey"); pi.setValue(999999); pi.setType(Integer.class); request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE httpTransport = new HttpTransportSE(url); Object response = null; try { httpTransport.call(SOAP_ACTION, envelope); response = envelope.getResponse(); xml = response.toString(); Log.d("xml:", xml); } catch (SoapFault e) { // TODO Auto-generated catch block Log.d("Soap Fault", e.toString()); } catch (IOException e) { // TODO Auto-generated catch block Log.d("IOexception", e.toString()); } catch (XmlPullParserException e) { // TODO Auto-generated catch block Log.d("XmlPullParserException", e.toString()); } return xml; } </code></pre> <p>It returns a <strong>nested SOAP structure</strong> <em>confirmed</em> by the Log entry which i make ( <code>Log.d("xml:", xml);</code> ) The corresponding LogCat entry is: (i've formatted it to make it the SOAP structure's heirarchy apparent... )</p> <pre><code>anyType{ SOBKeyList=anyType{ Key=anyType{value=12686 ; }; Key=anyType{value=16238 ; }; Key=anyType{value=26978 ; }; }; } </code></pre> <p>The reason why i necessarily need an XML is because later I parse the string to get a <strong>DOM</strong> element and when the above string is passed it returns the following: </p> <p>org.xml.sax.SAXParseException: Unexpected token (position:TEXT anyType{SOBKeyLi...@1:119 in java.io.StringReader@40ec9c68) </p> <p>also from there onward my entire code depends on the fact that the response was <strong>XML</strong>. </p> <p><strong>Explaination of the reason why i expected an XML</strong> : Now you may asked why I coded my app expecting XML when i had not tested the Web service the reason is: The Web service was coded my a third party who assured me of an XML response , now i dont have enough time to change my remaining code to exploit a SOAP structure !! -_- I'm in a fix. Please help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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