获取XMLPullParserException从Android连接到WCF时预期END_TAG

时间:2013-10-21 06:44:31

标签: android

我需要从我的Android应用程序连接到WCF webservices进行登录验证,为此,我已将 ksoap2-android-assembly-2.4-jar-with-dependencies.jar 添加到我的项目中。 以下是我的代码。

String emailtxt = null, password;

    emailtxt = email.getText().toString().trim();
    password = pwd.getText().toString().trim();

    Log.d("email", emailtxt);
    Log.d("password", password);

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    /*request.addProperty("arg0", emailtxt);
    request.addProperty("arg1", password);*/


    PropertyInfo pi = new PropertyInfo();
    pi.setName("UserName");
    pi.setValue(emailtxt);
    pi.setType(String.class);
    request.addProperty(pi);

    PropertyInfo pi2 = new PropertyInfo();
    pi2.setName("Password");
    pi2.setValue(password);
    pi2.setType(String.class);
    request.addProperty(pi2);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

    AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
    httpTransport.debug = true;
    SoapObject result = null;
    try {
        httpTransport.call(SOAP_ACTION, envelope);
        result = (SoapObject) envelope.getResponse();
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (result == null)
        Log.d("if resp null", result + "");
    else {
        // anything below this line relates to the service return type, may
        // not apply to you
        boolean success = Boolean.valueOf(result.getProperty("success")
                .toString());

        Log.d("login resp...not null", success + "");
    }

但我在我的logcat中得到了XMLPullParserException。任何人都告诉我如何修复它? 谢谢你的帮助。

0 个答案:

没有答案