Mike
Mike

Reputation: 1326

Consuming WCF/Rest from an Android app

I was working through a tutorial at http://fszlin.blogspot.com/2010/05/comsuming-wcf-services-with-android.html and am having a problem. The author of the tutorial doesn't look responsive so I figured I'd ask here.

I have the WCF service up and running. If I run the WCF Test application that comes with Visual Studio, I can access it no problem. My problem comes running it from the application, or even trying to hit it through the browser, nothing gets returned.

Here's what I've tried:

Setting a breakpoint in the WCF service and running the WCF Test application, when I make a call, it hits the breakpoint. Makes sense.

Putting the URL in a browser returns nothing (no error, no data) and the breakpoint never gets hit.

Putting the URL in the Android application and running it in the Android emulator returns nothing (no error, no data) and the breakpoint never gets hit.

Thinking that it might not be connecting from the browser or the Android app, I put in a bad URL into the browser (like changing it from http://localhost/hello.svc/GetPlates to http://localhost/hellotest.svc/GetPlates) returns an error, same in Android application.

So to me it seems like it's hitting the service properly, just for some reason not executing the code. I have no idea how to further test this. Aren't SOAP services supposed to be able to be hit from the browser? Especially when the function in the service you're calling takes no parameters and only returns data?

Again, it all works in the WCF test app, just can't seem to reach the goal of ultimately calling the service from the Android application.

Much thanks in advance!

Mike

Upvotes: 1

Views: 3883

Answers (2)

Sree Rama
Sree Rama

Reputation: 1227

I would like to add one more information based on experience shared from our .Net team. You should remove the "windows authentication" from the configuration before you deploy in a hosting server.

Upvotes: 1

Bill Craun
Bill Craun

Reputation: 905

You've likely found a solution already, but if you're using the default Visual Studio web server (aka Cassini), the reason is because it cannot accept remote connections for security purposes. This is a limitation of the built-in server and is by design. You can host it using a custom server by selecting the alternative radio button on the project property pages. You'll probably need to use IIS, WAS or Windows service host to accept remote HTTP connections.

Upvotes: 1

Related Questions