I am trying to communicate to the webservice on my laptop and using and Android phone as the client. I was trying to do a simple login function however, whenever the client tries to communicate with the webservice, this error pops out in the DDMS on Eclipse. I can access the webservice with my home network but not able to do so when i am in my school. In case you might ask this, the IP address in my sch is 172.22.XX.XX. Although i know is a private IP address, but even though my Android phone is connected to the same network, it still can't communicate with the webservice running on my laptop. Can anyone tell me how to solve thie problem
10-20 15:00:42.875: ERROR/AndroidRuntime(6728): fillInStackTrace():java.net.SocketException: No route to host
Here is the function that does the work:
public String[] getPassword(String loginID){
String[] temp = null;
SoapObject request = new SoapObject(NAMESPACE, "GetPassword");
PropertyInfo quotesProperty = new PropertyInfo();
quotesProperty.setName("LoginID");
quotesProperty.setValue(loginID);
quotesProperty.setType(String.class);
request.addProperty(quotesProperty);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
String result = "";
HttpTransportSE httpRequest = new HttpTransportSE(URL);
httpRequest.debug = true;
try
{
httpRequest.call(SOAP_ACTION, envelope);
Log.e("Request",httpRequest.requestDump.toString());
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
Log.e("Response",httpRequest.responseDump.toString());
result = response.toString();
if(result != null){
temp = result.split(";");
passwordSecurity crypto = new passwordSecurity();
temp[0]= crypto.cryptography(temp[0], false); //decrypt the password
}
}
catch(Exception e)
{
e.printStackTrace();
Log.e("AndroidRuntime", "getMessage(): "+e.getMessage());
Log.e("AndroidRuntime", "getLocalizedMessage(): "+e.getLocalizedMessage());
Log.e("AndroidRuntime", "fillInStackTrace(): "+e.fillInStackTrace().toString());
}
return temp;
}
Warnings from DDMS
10-20 16:56:32.180: WARN/System.err(13034): java.net.SocketException: No route to host
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.platform.OSNetworkSystem.connect(Native Method)
10-20 16:56:32.180: WARN/System.err(13034): at dalvik.system.BlockGuard$WrappedNetworkSystem.connect(BlockGuard.java:357)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:204)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:437)
10-20 16:56:32.180: WARN/System.err(13034): at java.net.Socket.connect(Socket.java:1002)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:75)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
10-20 16:56:32.180: WARN/System.err(13034): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)
10-20 16:56:32.180: WARN/System.err(13034): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76)
10-20 16:56:32.180: WARN/System.err(13034): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:146)
10-20 16:56:32.180: WARN/System.err(13034): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
10-20 16:56:32.180: WARN/System.err(13034): at android.wps.server.operations.WifiPositioningServices.getPassword(WifiPositioningServices.java:43)
10-20 16:56:32.180: WARN/System.err(13034): at android.wps.MainActivity$1.onClick(MainActivity.java:67)
10-20 16:56:32.180: WARN/System.err(13034): at android.view.View.performClick(View.java:2538)
10-20 16:56:32.180: WARN/System.err(13034): at android.view.View$PerformClick.run(View.java:9152)
10-20 16:56:32.180: WARN/System.err(13034): at android.os.Handler.handleCallback(Handler.java:587)
10-20 16:56:32.180: WARN/System.err(13034): at android.os.Handler.dispatchMessage(Handler.java:92)
10-20 16:56:32.180: WARN/System.err(13034): at android.os.Looper.loop(Looper.java:123)
10-20 16:56:32.180: WARN/System.err(13034): at android.app.ActivityThread.main(ActivityThread.java:3691)
10-20 16:56:32.180: WARN/System.err(13034): at java.lang.reflect.Method.invokeNative(Native Method)
10-20 16:56:32.180: WARN/System.err(13034): at java.lang.reflect.Method.invoke(Method.java:507)
10-20 16:56:32.180: WARN/System.err(13034): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
10-20 16:56:32.180: WARN/System.err(13034): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
10-20 16:56:32.180: WARN/System.err(13034): at dalvik.system.NativeStart.main(Native Method)