0

I've already searched around and found this

Connect an Android Device To a Web Service on Local Host

So here is my scenario.

I need to connect to a web service from my android application.

I have a web application running on my laptop. It contains the web service. Its all deployed on apache tomcat 7.0.47. The web service runs fine on localhost. I've also tested it from the android emulator and it calls and displays the output fine.

Now my question is, how do I connect the web service from the android device when its on a different network? I tried giving my public IP in the WSDL URL in the android client (uses ksoap2 libraries) but it doesn't work and gives ECONNREFUSED error in LogCat. I also read that I may have to map the public IP to my internal IP, but I don't know how to do that, and some help will be greatly appreciated.

Android device: Nexus 5 (4.4.2) Server: Apache Tomcat (7.0.47) Machine: MacBook Pro (Mavericks 10.9)

I shall provide code if needed.

Thanks a lot! Vaibhav

Community
  • 1
  • 1
  • i would first check if you can hit the webservice by putting the url address on the phone browser – tik27 Mar 15 '14 at 14:39
  • Hey! I tried that, but it doesnt seem to hit the web service wsdl. – Vaibhav Ravichandran Mar 15 '14 at 15:30
  • you might have to open a port on your outside IP or do port forwarding for the port communications to be routed your computer. – tik27 Mar 15 '14 at 17:28
  • @tik25 and how would I do that? some extra info or links would be much appreciated mate :) – Vaibhav Ravichandran Mar 17 '14 at 01:19
  • Depends on your router, you would have to find your router by looking up what the gateway address is in your network(ex 192.168.1.1) i would then put that address in your browser, most routers have a web admin interface, if its an apple router you would have to open up airport utilities. usually the port forwarding section is under the firewall section. You would put the port number you want to forward, then the address of your internal machine and its port as the target. hard to be fore specific since all routers are different – tik27 Mar 17 '14 at 16:32

0 Answers0