2

I am new in android.I am working on android app. For that i am calling web-services using Ksoap2(2.6) and calling 3 different json services. my problem is that when 1 or 2 services coming out of 3 then it is showing java.net.SocketTimeOutException.

Please tell me how to handle the HttptransportSE and TimeOut for avoid SocketTimeoutException. Thank you in advance.

2 Answers2

13

The way to fix this is:

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL,60000);

Notice the second parameter, which is the timeout value.

Janis Peisenieks
  • 4,938
  • 10
  • 55
  • 85
0

The problem is with the soap request.

At all the optional parameters needs to be replaced with the ZeroLengthSpace.

MKJParekh
  • 34,073
  • 11
  • 87
  • 98
  • This code is not working in my program.Please can you send me code in detail. Thank you in advance. – Gyanendra Kumar Apr 06 '12 at 12:11
  • is it giving error like `java.net.SocketTimeOutException : Read Timeout` – MKJParekh Apr 06 '12 at 12:16
  • yes, same only error I am getting.Like java.net. SocketTimeoutException. – Gyanendra Kumar Apr 06 '12 at 12:37
  • I am sure...the problem is with your SOAP object you are creating..check twice..you are not making any mistake in passing value of each property properly.. – MKJParekh Apr 06 '12 at 12:38
  • Hey..., I have checked problem is not with soap object. Some times I am getting response but sometimes it is giving java.net.SocketTimeOutException. So I want to increase the time out,Please tell me how to do this ? – Gyanendra Kumar Apr 09 '12 at 05:03