java.net.SocketException: The operation timed out

1,468 views
Skip to first unread message

ama10285

unread,
Jan 6, 2011, 10:25:07 AM1/6/11
to ksoap2-android
Hi all^^
I m trying to call a web service(DBUpdate.asmx) to use on of her
methods(datatSet getMesspunkte()),that retrieve data from the database
this is a .Net web service and the databae and the web services are
deployed on IIS.
But 2 Minutes after starting the Call i get a SocketException : The
operation timed out
I m using android 2.1 and I debug on Motorola Milestone
I hope that i add all required permission in the manifest

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /
>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /
>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"></uses-
permission>

and her is my code:

public ArrayList<String> getMesspunkte(){

String URL = "http://192.168.0.156/DBUpdate/DBUpdate.asmx";

ArrayList<String> dieMesspunkte = new ArrayList<String>();

SoapObject request = new SoapObject("ikaros", "getMesspunkte");
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);
try
{
androidHttpTransport.call("ikaros/getMesspunkte", envelope);
KvmSerializable ks = (KvmSerializable)envelope.bodyIn;
for(int i=0;i<ks.getPropertyCount();i++)
{
dieMesspunkte.add((String)ks.getProperty(i));
}

}
catch(Exception e)
{
e.printStackTrace();

Toast.makeText(getApplicationContext(),"ERROR",Toast.LENGTH_LONG).show();
}
return dieMesspunkte;
}

And Here is the occured error:

01-06 15:43:59.821: WARN/System.err(4042): java.net.SocketException:
The operation timed out
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.platform.OSNetworkSystem.connectSocketImpl(Native
Method)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.platform.OSNetworkSystem.connect(OSNetworkSystem.java:
114)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
245)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
535)
01-06 15:43:59.821: WARN/System.err(4042): at
java.net.Socket.connect(Socket.java:1054)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:
62)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager
$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:
67)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:
821)
01-06 15:43:59.821: WARN/System.err(4042): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:
807)
01-06 15:43:59.821: WARN/System.err(4042): at
org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:
46)
01-06 15:43:59.821: WARN/System.err(4042): at
org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:68)
01-06 15:43:59.821: WARN/System.err(4042): at
com.android.Endimna.Endimna_App.getMesspunkte(Endimna_App.java:246)
01-06 15:43:59.821: WARN/System.err(4042): at
com.android.Endimna.Messung_Activity.onCreate(Messung_Activity.java:
112)
01-06 15:43:59.821: WARN/System.err(4042): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
01-06 15:43:59.821: WARN/System.err(4042): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)
01-06 15:43:59.828: WARN/System.err(4042): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
01-06 15:43:59.828: WARN/System.err(4042): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-06 15:43:59.828: WARN/System.err(4042): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-06 15:43:59.828: WARN/System.err(4042): at
android.os.Handler.dispatchMessage(Handler.java:99)
01-06 15:43:59.828: WARN/System.err(4042): at
android.os.Looper.loop(Looper.java:123)
01-06 15:43:59.836: WARN/System.err(4042): at
android.app.ActivityThread.main(ActivityThread.java:4363)
01-06 15:43:59.836: WARN/System.err(4042): at
java.lang.reflect.Method.invokeNative(Native Method)
01-06 15:43:59.836: WARN/System.err(4042): at
java.lang.reflect.Method.invoke(Method.java:521)
01-06 15:43:59.836: WARN/System.err(4042): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-06 15:43:59.836: WARN/System.err(4042): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-06 15:43:59.836: WARN/System.err(4042): at
dalvik.system.NativeStart.main(Native Method)
01-06 15:44:33.969: WARN/SSM(1062): no ack

Please Help
Thx in advance

Umar .

unread,
Jan 7, 2011, 2:48:17 AM1/7/11
to ksoap2-...@googlegroups.com
what i understood is connection timeout is taking place

so
open defination of this function
androidHttpTransport.call() and look for

connection.setConnectTimeout(IntegerTimeoutValue);

increase it that may be causing problem to you
socket timeout problem always comes when ConnectTimeOut Takes place.

Manfred Moser

unread,
Jan 10, 2011, 12:23:21 PM1/10/11
to ksoap2-...@googlegroups.com
Correct. It definitely looks like your connection is timing out. Ensure that your url is correct and you can ping it from within the emulator (e.g. try accessing it via the browser..).

manfred

ama10285

unread,
Jan 11, 2011, 6:40:54 AM1/11/11
to ksoap2-android
I tried to access the webservice from within the emulator and from my
netbook it was both succesfull.
But i still can not connect to my webservice from my motorola
Milestone.
may be is this because of the IIS Server or because of my Device
or ...?
Do you know, if something should be set in the device settings.

thx in advance

ama10285

unread,
Jan 12, 2011, 7:16:37 AM1/12/11
to ksoap2-android
Now it works^^.
that was a problem in the server
thx all
Reply all
Reply to author
Forward
0 new messages