Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call a Restful web services from Android using two different IDEs  RSS feed

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!