Note that there are some explanatory texts on larger screens.

plurals
  1. POConnecting to Web Service with KSOAP2 - getting XmlPullParserException
    primarykey
    data
    text
    <p>I saw some other users with the same problem but honestly the answers didnt helped me.</p> <p>I have a android client which connects to a PHP Web Service (using NuSOAP), and locally everything works fine. When I deployed my webservice and updated the variables on the client, I'm getting the following error:</p> <blockquote> <p>org.xmlpull.v1.xmlpullparserexception: unexpected type (position: END_DOCUMENT null@1:0 in java.io.InputStreamReader@44f11f30)</p> </blockquote> <p>This happens randomly - for example, for login, if the first try is "wrong password" (sucessfull connection to the web service) the second try I get that error. If it's accepted I got a force close of the application (i start another activity) I suppose it's because of that problem.</p> <p>I have no idea what's the problem much because I don't handle any XML file manually and my WDSL is fine as you can see <a href="http://apkitchen.voku-online.de/webs.php?wsdl" rel="nofollow"><strong>here</strong></a></p> <p>My connect strings are the following:</p> <pre><code>private static final String URL = "http://apkitchen.voku-online.de:8080/webs.php"; private static final String NAMESPACE = "urn:hellowsdl"; final String SOAP_ACTION = "urn:hellowsdl#auth"; final String METHOD_NAME = "auth"; SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); </code></pre> <p>My full connecting function is:</p> <pre><code>public Object soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("username", "Maxxd"); request.addProperty("password", "xxxx"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); HttpTransportSE httpTransport = new HttpTransportSE(URL); httpTransport.call(SOAP_ACTION, envelope); Object result = envelope.getResponse(); return result; } </code></pre> <p>I honestly have no idea why this happens.... any help?</p> <p><strong>FOUND THE PROBLEM (BUT NOT THE SOLUTION...)</strong></p> <p>I dumped the response xml file, and looks like it's mall formed:</p> <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;SOAP-ENV:Body&gt; &lt;ns1:authResponse xmlns:ns1="urn:hellowsdl"&gt; &lt;return xsi:type="xsd:string"&gt;0&lt;/return&gt; &lt;/ns1:authResponse&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; &lt;!.................. </code></pre> <p>The envelope itself it's ok, but there is not ending comment tag... how can I solve this ?</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.
 

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