Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 595
Waheed Khan Avatar asked Feb 29 '12 17:02

Waheed Khan


People also ask

What is the difference between WCF and web services?

Web services support only one protocol- HTTP and HTTPS during communication, but WCF supports more protocols like- HTTP, TCP, and MSMQ that can be extended for a comprehensive solution, reliable session, and transactions. It signifies WCF is more adaptable to work together for a variety of software.

What is the difference between Web service and REST service?

Web services are a type of API, which must be accessed through a network connection. REST APIs are a standardized architecture for building web APIs using HTTP methods.

Does WCF use SOAP or REST?

Normally, a WCF service will use SOAP, but if you build a REST service, clients will be accessing your service with a different architectural style (calls, serialization like JSON, etc.). Exposing a WCF service with both SOAP and REST endpoints, requires just a few updates to the codebase and configuration.

What are the differences between WCF and ASMX web services?

5) The purpose of ASMX services is to send and receive data using SOAP over HTTP protocol. However, WCF services can send and receive data using any format over different protocols like HTTP, HTTPS, TCP, MSMQ etc.


4 Answers

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.

like image 112
Raymond Saltrelli Avatar answered Sep 24 '22 06:09

Raymond Saltrelli


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.

like image 41
Rajesh Avatar answered Sep 20 '22 06:09

Rajesh


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.

like image 41
Justin Pihony Avatar answered Sep 21 '22 06:09

Justin Pihony


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.

like image 32
John Saunders Avatar answered Sep 22 '22 06:09

John Saunders