KSOAP2调用异步webservice得到了illegalArgumentException

时间:2013-01-04 09:27:56

标签: android web-services ksoap2 android-ksoap2

我正在使用KSOAP2调用异步Web服务(服务器不返回任何内容)。 Web服务调用已经成功,我可以从服务器看到,但HttpTransportSE.call抛出异常并使应用程序崩溃。

我的代码是:

envelope.bodyOut = soap;
    envelope.dotNet = false;
    MarshalDouble md = new MarshalDouble();
    md.register(envelope);


        HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
        androidHttpTransport.debug = true;
        try {
            androidHttpTransport.call(null, envelope);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        }

,错误日志为:

01-04 17:25:05.930: E/Trace(17787): error opening trace file: No such file or directory (2)
01-04 17:25:06.145: E/SensorManager(17787): thread start
01-04 17:25:19.145: E/AndroidRuntime(17787): FATAL EXCEPTION: AsyncTask #2
01-04 17:25:19.145: E/AndroidRuntime(17787): java.lang.RuntimeException: An error occured while executing doInBackground()
01-04 17:25:19.145: E/AndroidRuntime(17787):    at android.os.AsyncTask$3.done(AsyncTask.java:299)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.lang.Thread.run(Thread.java:856)
01-04 17:25:19.145: E/AndroidRuntime(17787): Caused by: java.lang.IllegalArgumentException: size <= 0
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.io.BufferedInputStream.<init>(BufferedInputStream.java:94)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:219)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:114)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at com.oracle.bpm.mobile.fragment.PSIRFragment.callBPMProcessAcceleratorAdapter(PSIRFragment.java:447)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at com.oracle.bpm.mobile.fragment.PSIRFragment.access$1(PSIRFragment.java:368)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at com.oracle.bpm.mobile.fragment.PSIRFragment$CallPSIRMobileAdapterTask.doInBackground(PSIRFragment.java:364)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at com.oracle.bpm.mobile.fragment.PSIRFragment$CallPSIRMobileAdapterTask.doInBackground(PSIRFragment.java:1)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-04 17:25:19.145: E/AndroidRuntime(17787):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-04 17:25:19.145: E/AndroidRuntime(17787):    ... 5 more

有人知道为什么吗?如何使用kso​​ap调用异步Web服务? 感谢。

1 个答案:

答案 0 :(得分:0)

我检查了HttpTransportSE.java的代码,似乎没有办法阻止它获得响应。所以我必须将我的Web服务更改为同步并返回类似确定的问题以解决此问题。希望KSOAP2能解决这个问题。