简体   繁体   中英

KSOAP2 android error expected start_tag

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM