KSoap2 未返回有效 xml?

KSoap2 is not returning valid xml?

我正在尝试从 Web 服务获取 xml 数据。 xml数据是这样的

<Result>
<ErrorCode>0</ErrorCode>
<ErrorMessage>Login was succesful.</ErrorMessage>
<AuthCode>maneen90234</AuthCode>
</Result>

但我从 KSoap 2 得到的是以下字符串

anyType{Result=anyType{ErrorCode=1; ErrorMessage=Incorrect Username or Password; };

这就是我调用网络服务的方式

private String callAPI(String user, String password) {
        request = new SoapObject(NAME_SPACE, "UserLogin");
        PropertyInfo pi = new PropertyInfo();
        addProperty(pi, request, "UserId", user, String.class);
        addProperty(pi, request, "Password", password, String.class);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;

        envelope.setOutputSoapObject(request);

        androidHttpTransport = new HttpTransportSE(url);

        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
            response = envelope.getResponse().toString();
        } catch (Exception exception) {
            response = exception.toString();

        }
        return response;
    }

    private void addProperty(PropertyInfo pi, SoapObject request, String UserId, String value, Object type) {
        pi = new PropertyInfo();
        pi.setName(UserId);
        pi.setValue(value);
        pi.setType(type);
        request.addProperty(pi);
    }

我尝试了 SO 上可用的各种答案,但无济于事。知道我在这里做错了什么吗?

看起来ksoap2正在解析数据本身并返回数据的属性。我正在提取如下数据 -

SoapObject response = (SoapObject) ((SoapObject)envelope.getResponse()).getProperty(0);
 if(response.getProperty("ErrorCode").equals(1))
        {
            Toast.makeText(context,"Login sucessful",Toast.LENGTH_LONG).show();
            Log.d(TAG, String.valueOf(response));
        }
        else {
            Toast.makeText(context,"ErrorCode",Toast.LENGTH_LONG).show();
            Log.d(TAG, String.valueOf(response));
        }

虽然我仍然遇到传递参数的问题,但我会 post 单独提出相同的问题。