开发者

Ksoap Library and Request Time out?

i am using ksoap library to call webservice in android. i dont see request timeout property here in case of INTERNET is not available in the middle of call so it is important to have it.

some one suggested me to use socket class which has Sotimeout but i dont know how to implement it here any one suggest me what should i do?

public void callWebservice()
{
try {

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

requ开发者_如何学Goest.addProperty("passonString", "anything");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);

..
...
}catch(Exception ex)
{}

}


You would have to modify the HttpTransportSE class to take a timeout parameter that passes through to the socket. It would be pretty simple to implement, but looking at the HttpsTransportSE class that already does this.

Then you could catch the SocketTimeoutException and do whatever necessary. Feel free to create an issue on the project and or contribute the enhancement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜