Rich S
Rich S

Reputation: 3455

Android app communicating with WCF

I currently have a client/server application which is based on Windows technology (using C# .net). I use WCF with transport and message credentials. (i.e. SSL with basic username/password message authentication)

One of the projects about to come up, is to allow the client side to run on an Android platform (phone or tablet).

Are there Android/Java/Linux libraries available to consume a WCF service from within Android code ?

If not, I guess I'll have to write a wrapper around the services and use an alternative method.

Upvotes: 1

Views: 2027

Answers (2)

Neil
Neil

Reputation: 1633

You can also create a JSON binding for your WCF service - that is expose your WCF service as both a WCF service and a JSON service - then use the standard Android webservice method - which is kind of hokey. The advantage of this approach is that you don't have to distribute KSoap - and you are writing less code for the android. JSON is also uses less band width (if that is an issue)

Upvotes: 1

Andrew
Andrew

Reputation: 14457

WCF basically exposes a SOAP service (provided the binding is set up that way). A fairly current-looking Android library can be found at http://code.google.com/p/ksoap2-android/.

There is some setup you need to do on the WCF side, though. First off, do not use Message security. Use Transport security only. Transport allows you to use HTTPS, which is what you are wanting. Message security in my experience only works between Windows clients, does not allow SSL (it encrypts the message itself so it can go over an unencrypted channel), and seems not to work with other types of clients. If I recall, you want to use some variation of BasicHttpBinding rather than WSHttpBinding, but I don't have a project in front of me at the moment to double-check.

Upvotes: 0

Related Questions