Android device not accessing web service on local WIFI - android

I have made an asp web service and I am accessing it from my android application through ksoap2 library. I have successfully accessed the service from emulator by 10.0.2.2:9000/Service1.asmx.
Now I am trying to access it from my android device but I am not able to access it.
I have already hosted the service on IIS and now I can access it from emulator by 192.168.xx.xxx/Service1.asmx.
The problem is still the same Can't see any result in my android app on device that is connected to the same LAN through WIFI, although I can see my web service through mobile browser now. In addition to that I have edited the web.config file to allow all systems on LAN to invoke my web service methods.
I just checked the error. Error toast is showing java io.IOException on device still runs without any error on emulator

I would suggest to check whether 192.168.xx.xxx/Service1.asmx. is reachable via android mobile browser. I doubt that your device could be in some other ip group.

Related

Why can't I connect to IISExpress from my Android device?

I am trying to connect to a ASP.NET WebApi service running on IISExpress through Visual Studio from an Android emulator (Genymotion specifically). I was able to set up my IISExpress bindings and firewall (as shown in posts similar to this and this) so that I could access the website externally.
I was able to successfully navigate to the service from another laptop on the network, but am still unable to accomplish it from the browser in the emulator or my own Android device (also on the network). When I try this I get a generic "Web page may not be available" message. Why can I access it from other external machines, but not the mobile devices?
Turns out Android is not able to resolve Windows hostnames so when I set up the binding to use my machine name it did not work. Once I changed it to use my IP address it was fixed.

Android web server nanohttpd - cannot connect from browser on same device

I have attempted to set up a simple web server on Android using the nanohttpd demo application without modification. The Android devices that I am using are running Android 4.0.3.
I am able to access the web server from other devices, but I am unable to connect to the web server from a browser (Firefox, Chrome, and the native Android browser) on the same Android device that the web server is running.
I have tried a variety of addresses and port combinations without success (localhost, 127.0.0.1, 10.0.0.2, the actual assigned IP address, port 8080, 8082). I have also tried having the nanohttpd application bind directly to 127.0.0.1, without success either. I have verified that I can ‘ping’ the addresses using a terminal application on the Android device, so it looks like the network connectivity is fine.
Is there a restriction on Android that will prevent a browser from connecting to the local web server instance, and if so, is there a configuration setting or permission that needs to be modified to allow this to work?
1) You need to grant internet permission in AndroidManifest.xml.
<uses-permission android:name="android.permission.INTERNET" />
2) Also the port 80 will not be available without root.
See this question for more information.
3) Disable any VPN or proxy app or data compression on your device
Through a bunch of trial and error, I believe that I have a handle on what is happening. When I switch from the web server application to the browser to try the request, the web server application is suspended and therefore will not accept the connection. I had assumed that the applications were running in the background, but apparently that is not the case.
I'll explore how to run the web server as a background service and see where that takes me.
After embedding the nanohttpd web server inside an Android service, all is working as I had originally intended.
Change the request url to http://localhost:port or if you want to use IP address for localhost on emulator you can use the documentation here.

Access local network from app while phone is acting as WiFi hotspot?

I'm writing an app that needs to be able to access the web server on my laptop. The phone I'm developing on is acting as a WiFi hotspot which my laptop is connected to. Everything is working fine if I try to access 192.168.43.16 in the phone's browser.
But the app I'm developing is not able to access the webserver for some reason. I'm guessing it's trying to use the 3G connection instead, which of course will not work. If I turn off mobile data I get an error message in my app saying that it can't connect to 172.30.253.241:8799, which seems to be my ISP's MMS server (?). That makes no sense to me, but maybe there's some caching going on here? Again, accessing my local webserver with Chrome in the phone works perfectly fine.
The app is using the "Android Asynchronous Http Client" by loopj, which is built on top of Apache's HttpClient. What can I do to make this work?
The reason I want to be able to access the local webserver is because it makes developing and debugging the server api used with my app a lot easier and faster than FTP-ing to my production server on the web.
Problem solved!
What I had to do was set the proxy of the AsyncHttpClient, using setProxy(), before making the request. I set the proxy address to the local IP address of my laptop running the web server.
client.setProxy("192.168.43.16", 80);
Now it seems to be working as expected.

Eclipse web service and Android device

I'm using eclipse to run a web service written in Java EE. So the service is launched on the local network (192.168.1.1 something like that).
My Android device, connected to the computer, is connected to the WiFi. My question is : is it possible to access the web service from my Android device without publishing the service on a server ? (I cannot access it via http:// 192.168.1.1:8080/myWebService/... Because i'm not n the same network)
I've tried to use the computer network while my device is connected to it but it's seems not to be possible with Windows 7.
As i mentioned in the comments, you have to use the IP of the computer which has the server.
I too had the same problem.If u want to access localhost from your device,here is a good tutorial:
http://www.mobitechie.com/android-2/how-to-access-localhost-on-android-over-wifi/

Not able to access the webservice available in same network in Android

I am using Android 2.1 tablet. I have created simple application which access my own webservice. It works well in emulator. But it fails on android device. I am getting timeout exception. I have internet permission and timeout permission as mentioned is few forum message. I have disabled firewall for my network. Though I couldn't ping it from Terminal emulator to check the network availability.
Also I tried access the webservice base url via browser in android device. It doesn't work. I have webservice running on port 9080 in a laptop which is connected to same wifi network as android device.
I am absolute clueless. Any help would be highly appreciated.
If the emulator was running on the same machine as the Web service, then perhaps your Web service is only accepting connections from localhost.

Categories

Resources