相关疑难解决方法(0)

KSOAP永远不会超时

我正在使用支持超时的ksoap2 2.5.4(在Android 2.2上).我正在使用Apache 2.2.16来处理我的请求.一切正常,但当我关闭我的Apache(或断开运行Apache的远程PC)时,呼叫永远不会超时.我正在使用单独的线程来调用我的WS,在这种情况下,这个线程停止工作/响应/停止大约2分钟.

int MSG_TIMEOUT = 15000;
HttpTransportSE httpTransport;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
httpTransport = new HttpTransportSE(URL, MSG_TIMEOUT);
httpTransport.debug = true;
httpTransport.call(SOAP_ACTION, envelope);//thread stops responding here
Run Code Online (Sandbox Code Playgroud)

我甚至尝试使用Timer在预定义的超时后取消该线程,但它不起作用.线程仍在那里等待2分钟.

TimerTask task;
Timer mTimer;
task = new TimerTask() {
  public void run() {               
    mThread.interrupt();
   }
 };
mTimer = new Timer();
mTimer.schedule(task, MSG_TIMEOUT);
Run Code Online (Sandbox Code Playgroud)

我也得到这个可能与它有关的警告(我不知道该怎么办):

Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.ksoap2.transport.KeepAliveHttpsTransportSE$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler …
Run Code Online (Sandbox Code Playgroud)

android timeout ksoap ksoap2 android-ksoap2

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

android-ksoap2 ×1

ksoap ×1

ksoap2 ×1

timeout ×1