Waheed Khan
Waheed Khan

Reputation: 1321

difference between WCF Services and Web Services and REST Service

What is the difference between WCF Services and Web Services in .net
When should I use WCF and when to use Web Services.Is REST and WCF service the same? Thanks

Upvotes: 26

Views: 44301

Answers (7)

Nico Dreyer
Nico Dreyer

Reputation: 71

I see this is quite an old thread, but I have asked a similar question recently.

The answers given have all similar relevance, but in my opinion Ray was the closest to what was actually asked. When designing or refactoring a web based solution, you always get the question should we go with SOAP or REST. The answer lies in the complexity of the business logic required behind the service. REST is good for simplistic API calls that usually contains small sets of requested data or over night processing with large sets, but mainly for data requests. SOAP is more of an interactive day to day service with business logic as well. For example many methods with plenty of parameters.

What we do as part of our web based solution, is to try and make use of both. For internal methods and primary functionalities we use SOAP, but for exposed APIs we prefer REST. Framework related, definitely WCF as preferred choice, irrespective if SOAP or REST.

Upvotes: 0

sreenu
sreenu

Reputation: 11

Wcf:wcf is a technology as part of .net framework which provides environment to work with different distributed technologies an by following unified programming model. wcf create a proxy. wcf support data contract serializer. records shown xml format.

**Rest:**Rest is an architectural style.which says use the existing features of the web in more effective,efficiency and simple manner.verbs like insert,update and delete. Rest cannot create a proxy. rest records shown jason format.

Web Service:a service which is hosted on website is called as webservice. web service support xmlserializer

Upvotes: 1

Ray Saltrelli
Ray Saltrelli

Reputation: 4218

Web Service is an abstract term encompassing a large variety of data providers for distributed systems. Perhaps you are referring to ASMX web services, which can still be found in the wild but aren't really widely used in new development these days.

WCF Service is Microsoft's implementation of SOAP. There are others implementations or you could roll your own (not recommended).

SOAP is a kind of stateful, session-based, message-based web service. It's good if your service is designed as a set of complex actions.

REST is a stateless, sessionless, resource-based web service. It's good if your service is designed to access data and perform simple CRUD operations on it. SOAP and REST are mutually exclusive. A service cannot be both. There are ways to manipulate vanilla WCF to make is RESTful but these techniques are becoming deprecated. If you want to implement a RESTful web service there are two main choices in the Microsoft world: WCF Data Services and ASP.NET Web API.

Upvotes: 27

John Saunders
John Saunders

Reputation: 161773

Some people mean "ASMX" when they say "Web Services".

Others just use "Web Services" to mean the generic technology, and consider WCF to be the current way to create Web Services on the .NET platform. The other kind are "ASMX Web Services", as distinguished from "WCF Web Services".

The "other kind" are a legacy technology, supported only for backwards compatibility. They should not be used for new development, so there's no point in you learning about them.

As others have stated, "REST" is an architecture style, not a technology.

Upvotes: 3

Rajesh
Rajesh

Reputation: 7876

REST is an architecture

WCF is a API in .NET Framework to build connected service oriented application.

In olden days a functionality developed as Web Service was accessible via internet and the same to be available on local network was available via Remoting.

Using WCF we don't need to develop different code for it to be accessible over internet and on local network. Just configuring it with bindings would be enough.

Upvotes: 9

Rich
Rich

Reputation: 2096

WCF is multifaceted, so I'm going to speak of it with respect to its most common usage. The general difference between WCF and REST services is centered around the content. A REST call is usually more message/document/entity centered (With customer entities, find those starting with M; With order entities, get order 12 and is tied to the HTTP protocol. WCF tends to be more operation centered (Invoke find operation with params, Invoke get operation with parameters). WCF also isn't tied to HTTP.

FYI, there are extensions to create REST based services using WCF (WebInvoke, WebGet attributes).

Upvotes: 1

Justin Pihony
Justin Pihony

Reputation: 67065

That is a very wide question...I am going to just give a brief high-level answer and suggest that you do some more searching as there are is already a lot written on each subject. But, hopefully this should give you a push in the right direction.

First, typically when people refer to WCF Services and Web Services, they are referring to the newer WCF conventions that make service calls fairly generic (they can be SOAP, REST, etc) and the old .asmx SOAP method of Web Services. So, along these lines, I would suggest looking more into WCF and SOAP/.ASMX for the difference of WCF and older Web Services.

As to WCF and REST, they are not the same. REST is more of an architecture, whereas WCF is a framework. As I already mentioned, WCF can be used to make SOAP calls or REST calls. I am not sure I can add much more without going into greater detail.

I will see if I can find some good articles on REST and WCF a little later, though. Personally, I do not see a reason to even pursue very far into the older way of calling web services (.ASMX pages) as WCF has pretty much made that obsolete. However, learning many different ways to skin a cat can be useful in an endeavor to find what fits you best.

Again, this is VERY high level, but these are very general topics with a lot surrounding each, so hopefully a high level overview will help direct you in studying deeper on each subject.

Upvotes: 4

Related Questions