1

i have already search this topic and still don't know how to make it work :(
I have a SOAP web service (ASP.NET), and this address (on my localhost) is http://localhost:50473/Service1.asmx

then i have soap client on my android device, i want to connect to use service from server. Many people said that i can't connect through usb cable, and i have to connect to the same wifi network and use the internal IP.
Ok, now my laptop and android device both connect to the wifi network,
my laptop got 192.168.43.17
my android device got 192.168.43.26

So how can the device connect to the SOAP server above ?
from my device, i use 192.168.43.17:50473/Service1.asmx but no luck :(

Trần Đức Anh
  • 127
  • 1
  • 2
  • 12

3 Answers3

6

You need to set uses-permission - android.permission.INTERNET in AndroidManifest.xml and also test that (http://192.168.43.17:50473/Service1.asmx) url on web-browser.

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
0

Use Http Connection

HttpClient httpclient = new DefaultHttpClient();            
HttpGet httppost = new HttpGet("http://localhost/");
HttpResponse response = httpclient.execute(httppost);              
HttpEntity ent=response.getEntity();
InputStream is=ent.getContent();
Matthias
  • 7,432
  • 6
  • 55
  • 88
Mahesh
  • 29
  • 2
  • Completely unrelated to question. In question writer asks for connecting to the computer, not the `localhost` on the device. – GokcenG Feb 23 '14 at 13:12
0

You may have your web server listening on your loopback interface and not on your network interface. Major signs of this are:

  • Hits on 127.0.0.1 and localhost (from localhost or Android emulator) work
  • Hits on 192.168.xxx.xxx do not work, whether from localhost, LAN, or WAN

I talk more about diagnosing this and fixing this in an answer here.

Community
  • 1
  • 1
einnocent
  • 3,567
  • 4
  • 32
  • 42