Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF vs WebAPI and native mobile devices

I've been working on a single-page web app that is entirely ajax-based (no POSTs) and for now I'm using ASMX for the web services while it's in development. The web services work with JSON data. For the release, I know I'll need to upgrade to either WCF or WebAPI.

Eventually, I plan to build native mobile applications that will work with the same web services as the web app. All things being equal, if I have to choose between the two, which option should I go with so that the web services can work with different client apps?

Thanks.

like image 951
frenchie Avatar asked Jan 23 '13 17:01

frenchie


People also ask

What is the main difference between WCF and Web API?

WCF is used for developing SOAP-based services whereas Web API is used for both SOAP-based and RESTful services. WCF does not offer any support for MVC features whereas Web API supports MVC features. WCF supports HTTP, UDP, and custom transport protocol whereas Web API supports only HTTP protocol.

When should we select WCF over Web API?

Use WCF to create reliable, secure web services that are accessible over a variety of transports. Use ASP.NET Web API to create HTTP-based services that are accessible from a wide variety of clients. Use ASP.NET Web API if you are creating and designing new REST-style services.

Which is more secure WCF or Web API?

WCF service provides us high level security framework which provide enterprise level security. It uses WS-I standard to provide secure service. But Web API uses web standard security such as basic authentication, token authentication and for more complex such as OAuth; Web API provides more flexibility.

Why Web API needed if you have already restful services using WCF?

Web API is open source an ideal platform for building RESTful services using the . NET Framework. Unlike a WCF REST service, it use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).


1 Answers

If your application is designed to be only accessible by mobile devices from various platform, it means you will have to find the common easiest denominator for all these platforms. So, in other terms, if interoperability is your concern, you will focus on one unique communication technology that all platform can use.

JSON + REST seems to be the common easiest denominator for many platforms today (of course including mobile ones). And if that's the only communication technology you will implement, WebAPI seems the obvious choice.

WCF is more extensible, more configurable, you can plug different bindings, different encodings, on different protocols, it implements SOAP, WS-*, it can be very fast (with carefully chosen bindings), you can also do JSON+REST with it, but you don't need all that power (and WCF can be also quite complex because of all these features), what you need seems to be ubiquity and simplicity. Given your requirements, I would choose WebAPI.

like image 89
Simon Mourier Avatar answered Nov 12 '22 03:11

Simon Mourier