Consuming a web service in an android application in localhost

sharktiger picture sharktiger · Dec 16, 2010 · Viewed 8.4k times · Source

I am trying to consume a web service that I created locally from an Android application. My problem is that in my Android app, at a certain point, I have to give an URL with parameters that looks like this : http://localhost:8080/CalculatorApp/CalculatorWSService/add?i=1&j=1

where CalculatorWS is the web service I use, add is the operation in it and i and j are parameters of add operation. For now I am using a sample app Calculator (from NetBeans) for testing and I want to retrieve the correct URL to give to my web service client (Android app) so it can give me back an XML to parse.

I tried to use that URL mentioned above but it doesn't work.

Does anybody know what is the correct URL to put ?

Answer

lomec picture lomec · Dec 6, 2012

you need to set URL as 10.0.2.2:portNr

portNr = the given port by ASP.NET Development Server my current service is running on localhost:3229/Service.svc

so my url is 10.0.2.2:3229

i'd fixed my problem this way

i hope it helps...