Question

I have a WebService running in a remote VM inside my company's network.

I can see the JSON response using Chrome on my laptop by typing the url in the address bar (http://VMaddress/servicename/).

However, I cannot do this using the Android emulator. My company uses a proxy and I have already defined it in both the emulator launch window and inside the Android application itself. I can connect to Google and stuff, but I still cannot connect to the remote VM.

So my question is:

How is networking handled in the Android emulator? I know it defines a different ip for localhost, but shouldn't I be able to at least see the JSON response in the emulator browser (since I defined the proxy that would allow me to access the Internet)?

Doesn't the emulator run on my laptop's connection?

I get a 403 forbidden response using both the emulator browser and the Android application.

I also tried another WebService URL (http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo) and I get a 200 response code, so my application is correctly accessing the Internet).

thanks in advance

---EDIT---

I snooped around in my connection settings in my laptop and going into the Proxy Settings in Chrome I had an exception in the proxy for the VM where my server is. Removing that exception gives me the same 403 forbidden error I have in my emulator.

How can I apply the same exception to the emulator?

Was it helpful?

Solution

Somehow I managed to "resolve" this.

I am not entirely sure this is the reason, but I followed these steps. The emulator must start while there is no network available.

I also have the DNS servers from my company set in the Launcher menu using the options: -dns-server server1,server2 (got the values from ipconfig /all in a command prompt). It will not work for me without these settings.

and I configured the proxy manually in the emulator by creating a new APN following these steps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top