当我使用kso​​ap2_android_assembly_3_0_0_RC_4_jar_with_dependencies.jar时,我经常遇到以下异常,为什么?

时间:2013-02-17 05:55:05

标签: android ksoap

我用来从Web服务器接口下载XML字符串数据的代码如下:

    public String getXMLStr() {

    String XMLStr = FLAG_DATA_FAILED;
    HttpTransportSE httpTransportSE = new HttpTransportSE(serviceURL, 10000);
    httpTransportSE.debug = true;
    SoapSerializationEnvelope serializationEnvelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER12);
    SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);



    serializationEnvelope.bodyOut = soapObject;
    try {
        httpTransportSE
                .call(SERVICE_NS + methodName, serializationEnvelope);
        if (serializationEnvelope.getResponse() != null) {
            SoapObject result = (SoapObject) serializationEnvelope.bodyIn;

            XMLStr = result.getProperty(0).toString();
            Log.i(TAG, "PropertyCount" + result.getPropertyCount());
        }
    } catch (IOException e) {
        e.printStackTrace();
        Log.i(TAG, "IOException----->" + e.toString());
        // return null;
        return FLAG_DATA_FAILED;
    } catch (XmlPullParserException e) {
        e.printStackTrace();
        Log.i(TAG, "XmlPullParserException------>" + e.toString());
        // return null;
        return FLAG_XMLPARSER_ERROR;
    }
    // XMLStr= FLAG_DATA_FAILED;
    return XMLStr;
}

我经常遇到的例外情况如下:

02-17 13:30:37.586: E/AndroidRuntime(30095): FATAL EXCEPTION: Thread-14147
02-17 13:30:37.586: E/AndroidRuntime(30095): java.lang.NullPointerException
02-17 13:30:37.586: E/AndroidRuntime(30095): at org.ksoap2.transport.ServiceConnectionSE.getResponseProperties(ServiceConnectionSE.java:85)
02-17 13:30:37.586: E/AndroidRuntime(30095): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:189)
02-17 13:30:37.586: E/AndroidRuntime(30095): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:114)

我想知道为什么????,谢谢

0 个答案:

没有答案