0

Hi All I'm using the KSOAP2 2.6.5 but I also used 2.4 until the 2.6.5 and i received the same error:

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <definitions name='wsLogin' targetNamespace='http://painel01.allinmail.com.br/wsAllin/login.php'>@2:403 in java.io.InputStreamReader@4375ba18) 

I tried the solution but so far have not found anything to solve

my code:

private String URL = "http://painel01.allinmail.com.br/wsAllin/login.php?wsdl";
private String METHOD = "getTicket";

private static final String NAMESPACE = "http://painel01.allinmail.com.br/wsAllin/login.php";
private static final String SOAP_ACTION = "http://painel01.allinmail.com.br/wsAllin/login.php#getTicket";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    SoapObject request = new SoapObject(NAMESPACE, METHOD);
    request.addAttribute("login", "testeallin");
    request.addAttribute("senha", "allin@teste456");
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    try {
        log("point A");
        androidHttpTransport.call(SOAP_ACTION, envelope);
        log("point B");
        String resultsRequestSOAP = envelope.getResponse().toString();
        log("point C");
        log(resultsRequestSOAP);
    } catch (Exception e) {
        e.printStackTrace();
        log(e.toString());
    }

}

private void log(String msg) {
    Log.d("KSOAP2", msg);
}

and my responce is only:

point A
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <definitions name='wsLogin' targetNamespace='http://painel01.allinmail.com.br/wsAllin/login.php'>@2:403 in java.io.InputStreamReader@4375ba18) 

how to I Can fixed it?

ademar111190
  • 14,215
  • 14
  • 85
  • 114
  • have you tried verifying the URL in your code? Try pasting it in the browser and ensure that service is returning a valid XML document – Parth Doshi Jun 24 '12 at 04:28
  • @ParthDoshi yep, I have a client in PHP and it's work fine, access the link on code "http://painel01.allinmail.com.br/wsAllin/login.php?wsdl" to see the xml – ademar111190 Jun 24 '12 at 04:48
  • Try using this : SoapPrimitive resultsRequestSOAP = (SoapPrimitive)envelope.getResponse(); String strRes = resultsRequestSOAP.toString(); – Parth Doshi Jun 24 '12 at 04:58
  • @ParthDoshi the code stop here "androidHttpTransport.call(SOAP_ACTION, envelope);" before this i get only null points of your code – ademar111190 Jun 24 '12 at 05:24
  • Hi is your machine is running behind proxy, whether yes or no, can you post your request dump this. It seems you are not getting proper SOAP Response. Try to post your Request and response dump of androidHttpTransport – iDroid Jun 29 '12 at 20:52
  • @ademar111190 were you able to solve it, I'm facing same issue! – coder Mar 10 '23 at 10:09
  • @coder TBH, it has so much time that I don't remember how this has ended. Anyway, ksoap is on version 3.x now; they have probably fixed it. – ademar111190 Mar 15 '23 at 12:24

1 Answers1

0

Check if the URLs are parsed properly.

I guess you are making your web methods in c#. If that is the case,then,

In c#, Go to Solution Explorer.
In that, check in Appcode if there is a file named app_offline.htm.

Right click and exclude it from project.

This little thing worked for me. Hope it helps someone having a similar problem.

Shachi
  • 1,858
  • 3
  • 23
  • 41
  • I'm quite a bit confused as to what makes you think this is the answer to this question. Besides, that's not where the app_offline.htm file is, and excluding it from the project may or may not work anyway, depending on how the app is deployed... Assuming this is an ASP.NET service in the first place, which I have no idea how you think so.. – Andrew Barber Mar 01 '13 at 11:49
  • Well I just solved it and this small thing really did work for me. If you are calling web methods from Android, of course it would be an online app and so excluding the code which doesn't allow the code to go online is probably what works. – Shachi Mar 01 '13 at 11:53
  • That worked for *you* because you were using an ASP.NET web service. There could be lots of other reasons for this, and it could happen on any web service on any framework. – Andrew Barber Mar 01 '13 at 11:55
  • I did mention that in my answer that it worked for me with web method in c#. – Shachi Mar 01 '13 at 11:58
  • Well, a quick check of the web service URLs would confirm that this isn't the problem. – Andrew Barber Mar 01 '13 at 12:00