Both Web Services and WCF are web technologies developed by Microsoft. Web Services were introduced in earlier versions of .NET, while WCF was added to .NET framework in later versions. Web services are used to build applications that can send/receive messages using SOAP over HTTP. WCF is for building distributed applications to exchange messages using SOAP over any transport protocol.
A Web Service (sometimes known as ASMX technology in .NET) is a method of communication over the network. According to W3C, a Web service is a system dedicated for supporting machine-to-machine transactions over a network. It is a Web API described in WSDL (Web Service Description Language) and Web services are usually self-contained and self-describing. Web services can be discovered using UDDI (Universal Description, Discovery and Integration) protocol. By exchanging SOAP (Simple Object Access Protocol) messages typically over HTTP (with XML), other systems can interact with Web services. Web services are used in number of ways such as RPC (Remote Procedure Calls), SOA (Service Oriented Architecture) and REST (Representational State Transfer). There are two automated design methodologies for developing Web services. The bottom-up approach deals with first creating the classes and then using WSDL generation tools to compose these classes as Web services. The top-down approach deals with defining the WSDL specifications and then using code generation tools to generate the corresponding classes. Web services have two major usages. They can be used as reusable application-components and/or to connect web applications running on different platforms.
WCF (Windows Communication Foundation) is a .NET API (Application Programming Interface), which provides a unified programming model for developing connected and service-oriented applications. More specifically, it is used for developing and deploying distributed applications with SOA. SOA deals with distributed computing in which consumers consume services. Multiple consumers can consume a single service and vice versa. WCF supports advanced web service standards such as WS-Addressing, WS-ReliableMessaging, WS-Security and RSS syndication (available after .NET 4.0). A WCF client uses an End Point to connect to a WCF service. Each service may have multiple endpoints exposing its contract. The term ABC is used to refer to the Address/Binding/Contract of WCF service. The communication between clients and services is conducted through SOAP envelopes.
What is the difference between Web Services and WCF?
There are some key differences between Web services and WCF services. Web services are used to build applications that can send/receive messages using SOPA over HTTP. However, WCF is for building distributed applications to exchange messages using SOAP and any transport protocol like HTTP, TCP, named pipes, and Microsoft Message Queuing (MSMQ), etc. Furthermore, WCF can be extended to work with any other transport protocol. Although Web services are very simple and easy to implement, WCF is architecturally more robust than Web service. Web services can only be hosted in IIS and the security is limited. But WCF can be hosted in IIS, self-host servers with console applications or Win NT services or any other server. Furthermore, unlike Web services, WCF supports binary .NET – .NET communications, distributed transactions, WS-* specifications, queued messaging and Restful communications.