2013-01-04 53 views
1

我打電話給一個異步Web服務(服務器不返回任何東西)使用KSOAP2。 Web服務調用已經成功,我可以從服務器看到,但HttpTransportSE.call拋出異常並崩潰了應用程序。KSOAP2調用異步webservice得到非法argumentException

我的代碼是:

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服務? 謝謝。

回答

0

我檢查了HttpTransportSE.java的代碼,似乎沒有辦法阻止它得到響應。所以我必須將我的Web服務更改爲同步並返回「確定」之類的內容來解決此問題。希望KSOAP2將解決這個問題。