3

Hi I am consuming a soap web service from my android application, I was able to get the response from my desktop browser where as it is not working in android emulator's browser and also in my application which runs on the emulator.

Arun Paarthi
  • 633
  • 7
  • 23
  • put your code and logcat.. – Sagar Maiyad Jun 18 '13 at 05:27
  • @Segi: I can't access the web service from my android emulator's browser itself then how come it will work in my app it's throwing IOException Http request failed Http status 500 internal server error – Arun Paarthi Jun 18 '13 at 05:30
  • then something wrong with webserver.. – Sagar Maiyad Jun 18 '13 at 05:36
  • Is it compulsory to use SOAP for your application? I am asking because when we used it, it takes almost 8 sec of req/res time. And we have to change that scenario to JSON HTTP req/res. And emulator have very down settings for web service call. Even though if you call any web service though it is simple HTTP, it will take twice or thrice time then device. – Chintan Rathod Jun 18 '13 at 05:45
  • @Chintan Rathod: I am just consuming the soap service someone from client side is handling the soap service and yes soap is compulsory – Arun Paarthi Jun 18 '13 at 06:00
  • @ArunPaarthi, If you can afford some second hand device, just purchase it and will solve your problem. 2.7" device will be fine. You just need to check one time whether service are working fine or not. And what `Bhavesh Patadiya` has given solution, will worked coz i had also done the same thing. – Chintan Rathod Jun 18 '13 at 06:01
  • I have devices but even in devices also it's not working both in 3G and from my office network wifi. – Arun Paarthi Jun 18 '13 at 06:45

1 Answers1

2

If you are referring your localhost on your system from the Android
emulator then you have to use http://10.0.2.2:8080/. Because Android
emulator runs inside a Virtual Machine(QEMU) therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

While calling the Webservice from your Emulator Web Browser Verify that 10.0.2.2 is your machine address(run ifconfig to verify it )

let say if your webservice is

 http://localhost:39064/AndroidServiceImpl.svc/.. 

then while calling this from your emulator you have to use 10.0.2.2 instead localhost

you should call webservice like

 http://10.0.2.2:39064/AndroidServiceImpl.svc/.. 

Hope it will help.

Bhavesh Patadiya
  • 25,740
  • 15
  • 81
  • 107