Click here to Skip to main content
12,403,811 members (68,580 online)
Rate this:
 
Please Sign up or sign in to vote.
Hello Sir,

In my project i have to get data's from either url-1 or url-2 webservice which has same stored procedure but different data's.whenever i connect to any one of this url at first time it get connected and fetch data from the webservice but if i give another url it returns exception, eventhough my device wifi connectivity is also high.

It works once i changed the wifi turn off and on.

what actually happens......i cant solve is problem......pls help


This is my error


java.net.SocketException: No route to host     
at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native Method)
at org.apache.harmony.luni.platform.OSNetworkSystem.connect(OSNetworkSystem.java:115)
at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:244)
at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
at java.net.Socket.connect(Socket.java:1055)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:46)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:68)
at com.mobile.project.callsdue.activity.NewWebServiceCall.WebServiceUserList(NewWebServiceCall.java:88)
at com.mobile.project.callsdue.activity.CallsDueLoginPage$5.onItemSelected(CallsDueLoginPage.java:659)
at android.widget.AdapterView.fireOnSelected(AdapterView.java:864)
at android.widget.AdapterView.access$200(AdapterView.java:42)
at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:830)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4914)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Posted 6-Nov-11 19:41pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try by calling one service at a time. Check are you able to connect to both your Web Services one at a time. From the Exception details it sounds to be your Service is unreachable from the Device.

You may also post your Question on Android Developers Forum.
http://groups.google.com/group/android-developers/topics
  Permalink  
Comments
jacobjebaraj 7-Nov-11 2:17am
   
thanks for ur suggestion,

yeah ofcourse i calling one service at a time when i login to my app,after logout have to change the url-1 to url-2 manually which has to be done in my app settings page and then move on to login page to call url-2 webservice,i got this error.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Fix links

android - wcf rest service communication[^]
Android Socket: java.net.SocketException: No route to host[^]
Android's java.net.SocketException: No route to host[^](Results The solution is to set in off the WiFi capabilities, and then re-open WiFi, no problem results) <---Chinese site
  Permalink  
Comments
RaisKazi 7-Nov-11 4:05am
   
Indeed it's rude to downvote from OP for the Answer which is a honest attemp of help. 5ed
thatraja 7-Nov-11 4:14am
   
Don't know did he check those links or not. Thanks BTW 5! for you too.
jacobjebaraj 7-Nov-11 4:28am
   
yeah i have checked those links still i could't find solution...
jacobjebaraj 7-Nov-11 4:21am
   
I'm not given downvote MR.RaisKazi, your answer was really useful but i could't find the solution that's why i have given vote for your solution not demotivate your helping tendency....don mistake.....:-)
thatraja 7-Nov-11 4:27am
   
Oops :sigh: Here before some Q/A enquirers did the same thing when they couldn't the answers, so we guessed. Thank you :)
jacobjebaraj 7-Nov-11 4:29am
   
Thanks for kind reply MR.Raja
thatraja 7-Nov-11 4:39am
   
You welcome. Cheers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 7 Nov 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100