WCF - Vs Web Services


WCF - Vs Web Services 

What is Web Service?

  • A web service is a communication methodology exposed via HTTP address over the world wide web(WWW) used on the application of Internet. 

What is WCF Service?

  • Windows Communication Foundation (WCF) is a framework for creating and installing Interoperability and Service Oriented Architecture (SOA) based distributed services. 


Options in ASMX and WCF Files

Difference between Web Service and WCF Service :

Sr. No

Features

ASP.net Web Service

WCF Service

1

File Format/Extension

 Supports .asmx file extension.

 Supports .svc file extension.

2

Hosting

 

1.         In IIS.

2.         As a Windows Service.

1.     In IIS,

2.     As Windows Activation Services(WAS),

3.     As Managed Windows Services

4.     Self-Hosted.

3

Transport Protocols/Binding

Custom binding with HTTP & TCP protocols.

 Supports various  protocols such as HTTP, WS-HTTP, TCP,  Named Pipes, MSMQ & P2P(Point to Point).

4

Data Transformation

Uses XML serializer.

Uses DataContractSerializer.

5

Serialization NameSpace

System.XML.

Serialization

System.RunTime.Serialization

6

Supported Operations

One-Way Request-Response.

One-Way, Request-Response and Duplex models.

7

Encoding

XML1.0, MTOM (Message Transmission Optimization Mechanism), DIME (Direct Internet Message Encapsulation) formats.

XML1.0, MTOM, Binary formats. MTOM is used for larger messages.

8

WebMethods and DataContract

WebMethods interpret .Net code into XML.

·                [WebService] attribute has to be added to into the class.

·                [WebMethod] attribute represents the method exposed to the client.

DataContractAttributes and DataMemberAttribute interprets .Net code into XML.

·          [ServiceContract] attribute has to be added to into the class.

·          [OperationContract] attribute represents the method exposed to the client.

9

Messaging

SOAP(Simple Object Access Protocol) for messaging.

SOAP is default messaging. Extend supports to other transport protocols also.

10

Security

Security is at minimal level only with UserName/Password credentials.

High level of security rendered by WS specifications.

11

Performance

Slow Performance.

Good performance.

12

Exception Handling

Returns unhandled exceptions as SOAP faults.

 Returns unhandled Exceptions as    just faults to the Client for debugging and error fixing.

13

Limitations

Serializes public properties/fields and not Hash Table.

Serializes public properties/fields and Hash Table.