سؤال

Before I continue, I just want to mention I have heavily researched and searched on this topic, but I need the opinion of people who have worked/and or have practical knowledge with regards to this topic.

We are currently looking at developing an API so that clients can utilize this. We are definitely set on REST as opposed to SOAP, but I am still a little unclear about what exactly the difference is, if you go down to microscopic detail.

Having a look at msdn (Choosing which technology to use), the link below:

http://msdn.microsoft.com/en-us/library/jj823172.aspx

The differences are clear. However, the first point states for WCF:

Enables building services that support multiple transport protocols (HTTP, TCP, UDP, and custom transports) and allows switching between them.

For ASP.NET Web Api:

HTTP only. First-class programming model for HTTP. More suitable for access from various browsers, mobile devices etc enabling wide reach.

So, both support HTTP, but WCF supports more protocols in addition. What makes ASP.NET Web API more suitable for, I quote: "More suitable for access from various browsers, mobile devices etc enabling wide reach." if both support HTTP?

We have until now, relied heavily on PC use. What I am getting to, and finally my question is:

We plan on going mobile, and moving a lot more to multiple devices, browsers etc. But I just would not like to go on a service on the basis of a bit of text saying "Web API" is more suitable? IS it more efficient, less resource intensive etc.? With regards to future proofing? Would we be better of with WEB API and why? Just lastly, we have existing SOAP services, everything we have is built in SOAP.

Please do not hesitate to go into detail, I am not an experienced dev, just trying to add a contribution to this project.

Just a last couple of requirements:

1) We plan on utilizing JSON. 2) We are limited to .NET 3.5/4. 3) Must be REST.

هل كانت مفيدة؟

المحلول

Its all hype for the different products written by different product teams with incentive to get their baby adopted. Ignore them all and evaluate what you need, not what they need you to want.

What I do know if that ASP.NET projects require a heap of infrastructure (eg IIS, and associated configuration), whereas WCF can be built as stand-alone services that just run with minimal configuration (typically registering the root URL with http.sys). This is the biggest win for me - recently we had some older ASP.NET projects that we had to integrate with, and what could have been an easy task with some WCF services was a huge PiTA as we had to go through a mass of setup instructions (that were not necessarily up to date, of course) to get something working, not to mention the installation of system services to do this.

So you need to consider the future maintenance involved. If WebAPI requires a heap of setup, then I'd avoid it.

There are alternatives, WWS is much more efficient as WCF and supports the same protocols (not that it matters if you're only using HTTP). If you are just building a REST API then any web server, embedded or not, will do. (eg I added Mongoose to one of my services recently, so now it serves http to clients as well, seamlessly and really simple though using C++ not C#).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى softwareengineering.stackexchange
scroll top