简体   繁体   English

预期的KSOAP2 Android错误start_tag

[英]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: 大家好,我使用的是KSOAP2 2.6.5,但我也使用了2.4,直到2.6.5,并且收到相同的错误:

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. 检查URL是否正确解析。

I guess you are making your web methods in c#. 我想您正在用C#制作Web方法。 If that is the case,then, 如果是这样的话

In c#, Go to Solution Explorer. 在c#中,转到解决方案资源管理器。
In that, check in Appcode if there is a file named app_offline.htm. 在那儿,检查Appcode中是否有一个名为app_offline.htm的文件。

Right click and exclude it from project. 右键单击并将其从项目中排除。

This little thing worked for me. 这个小东西对我有用。 Hope it helps someone having a similar problem. 希望它可以帮助遇到类似问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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