How to call a Restful web services from Android using two different IDEs
Post by:Jhon Parker
, Ranch Hand
Hi I have a Spring MVC web application and I believe that this application is a RESTful web service application I'm not very sure I think that is a RESTful web service application because it have methods like POST GET in the controllers and those controllers have the @ResponseBody tag and some of then return JSON strings.
My question is that I'm now doing an Android application in Eclipse IDE, and my Spring MVC web application is in Netbeans IDE, It is possible to call a RESTful web services from my Android app in Eclipse if this RESTful web services is in a Spring MVC Nentbeans IDE application? I don't know if my Android application that runs in a virtual device it's using in a way the localhost and if then I try to run my netbeans application it somehow create a conflict between the two IDEs.
Post by:Karthik Shiraly
A web application typically serves requests from localhost - 127.0.0.1 - on some port - usually 80 or 8080.
An android application running in emulator can reach the machine's localhost through the special IP address, 10.0.2.2. Read this link to understand emulator networking.
When android app in emulator opens a connection to "http://10.0.2.2:8080/yourservice", the emulator translates that 10.0.2.2:8080 into 127.0.0.1:8080 of host machine and forwards request to your web application.
There won't be any conflict.
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Thread Boost - a very different sort of advertising