File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Running local webservice on android device connected using USB cable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Running local webservice on android device connected using USB cable" Watch "Running local webservice on android device connected using USB cable" New topic
Author

Running local webservice on android device connected using USB cable

Pawan Choure
Greenhorn

Joined: May 11, 2008
Posts: 27

I have developed an application in android using ksoap2 which used local .NET webservice and it works perfectly fine on the Emulator but when i connected the device the application starts on he device but the web service call does not work

I think i need to change the URL for the webservice.Given below is the current URL which i am using and it works on emulator but doesnt work on android device.

String NAMESPACE = "http://tempuri.org/";
String URL = "http://10.0.2.2:12736/InventoryWebService.asmx";


I google and tried many options but no help , so can anyone have any idea regarding the same then please do reply.


Pawan Choure
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

Who assigns the physical IP?

If over WI-FI then usually the router.

If over 3/4G cellular then you are at the mercy of the carrier.

WP
Pawan Choure
Greenhorn

Joined: May 11, 2008
Posts: 27

I didn't get what you said about the physical IP, i have connected my andriod device with my pc using USB cable....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41096
    
  44
10.0.1.2 is the IP for accessing the desktop machine to which the device is connected.


Ping & DNS - my free Android networking tools app
Pawan Choure
Greenhorn

Joined: May 11, 2008
Posts: 27

Thanks for youe reply Ulf, Will surely try that, I just wanted to confirm , what will be the port number in that case or there is no need to provide port number in the URL.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41096
    
  44
The port number is whatever port you want to connect to.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Running local webservice on android device connected using USB cable
 
Similar Threads
issue: no application can perform this action , when send mail
Connecting to local Web Service from Android emulator does not work
Want to develop an android application using GPS
Connecting Internet from android code
how to find out if code is running on the emulator?