Categories :- Introduction to WCF
EST architectural style is known as RESTFul Services.
Web Services | WCF Services |
Web services were developed for building applications that send and receive messages by using the Simple Object Access Protocol (SOAP) over HTTP. The structure of the messages can be defined using an XML Schema, and a tool is provided to facilitate serializing the messages to and from .NET Framework objects. The technology can automatically generate metadata to describe Web services in the Web Services Description Language (WSDL) | WCF services were developed for building applications to send and receive messing by using many formats and conveyed by using any transport protocol. Simple Object Access Protocol (SOAP) is used by default format.The structure of the messages can be defined using an XML Schema, and there are various options for serializing the messages to and from .NET Framework objects. WCF can automatically generate metadata to describe applications built using the technology in WSDL, and it also provides a tool for generating clients for those applications from the WSDL. Support for sending messages using not only HTTP, but also TCP and other network protocols. The ability to switch message protocols with minimal effort. Support for hosting services on hosts other than a Web server. Built-in support for the latest Web services standards (SOAP 1.2 and WS-*) and the ability to easily support new ones. Support for security, transactions and reliability. Support for sending messages using formats other than SOAP. |
XmlSerializer | DataContractSerializer |
ASP.NET relies on the XmlSerializer to translate data represented by .NET Framework types to XML for transmission to or from a service and to translate data received as XML into .NET Framework objects. Defining the complex data types that an ASP.NET service is to use requires the definition of .NET Framework classes that the XmlSerializer can serialize to and from XML. | The DataContractAttribute signifies that zero or more of a type’s fields or properties are to be serialized, while the DataMemberAttribute indicates that a particular field or property is to be serialized. The DataContractAttribute can be applied to a class or structure. The DataMemberAttribute can be applied to a field or a property, and the fields and properties to which the attribute is applied can be either public or private . Instances of types that have the DataContractAttribute applied to them are referred to as data contracts in WCF. They are serialized into XML using DataContractSerializer . |
The XmlSerializer and the attributes of the System.Xml.Serialization namespace are designed to allow you to map .NET Framework types to any valid type defined in XML Schema, and so they provide for very precise control over how a type is represented in XML. | The DataContractSerializer , DataContractAttribute and DataMemberAttribute provide very little control over how a type is represented in XML. You can only specify the namespaces and names used to represent the type and its fields or properties in the XML, and the sequence in which the fields and properties appear in the XML. Everything else about the structure of the XML used to represent the .NET type is determined by the DataContractSerializer . By not permitting much control over how a type is to be represented in XML, the serialization process becomes highly predictable for the DataContractSerializer , and, thereby, easier to optimize. |
Lesser performance compared with WCF DataContractSerializer . | A practical benefit of the design of the DataContractSerializer is better performance, approximately ten percent better performance. |
The attributes for use with the XmlSerializer do not indicate which fields or properties of the type are serialized into XML. | DataMemberAttribute for use with the DataContractSerializer shows explicitly which fields or properties are serialized. Therefore, data contracts are explicit contracts about the structure of the data that an application is to send and receive. |
The XmlSerializer can only translate the public members of a .NET object into XML. | The DataContractSerializer can translate the members of objects into XML regardless of the access modifiers of those members. |
Instances of collection classes can be serialized into XML only if the classes implement either the IEnumerable or ICollection interface. | The DataContractSerializer is much more likely to be able to serialize the instances of any pre-existing .NET type into XML without having to either modify the definition of the type or develop a wrapper for it. |
Classes that implement the IDictionary interface, such as Hashtable , cannot be serialized into XML. | It can translate into XML types like Hashtable that implement the IDictionary interface. |
XmlSerializer does not support versioning. | The DataContractSerializer incorporates some support for versioning. |
XmlSerializer serializes a type by default is semantically identical to the XML. | DataContractSerializer serializes a type, provided the namespace for the XML is explicitly defined. |
What is REST & RESTful?
Representational State Transfer (REST) is introduced by Roy Fielding on 2000; it is an architectural style of large-scale networked software that takes advantage of the technologies and protocols of the World Wide Web. REST illustrate how concentrated data objects, or resources, can be defined and addressed, stressing the easy exchange of information and scalability.EST architectural style is known as RESTFul Services.
WCF Services | RESTFul Services |
Endpoints have to create for each network protocol | It can be connect over "Web" with HTTP request/response messages. |
It works based on the Remote Procedural Call (RPC) | It is working with HTTP's uniform interface |
Service Reference has to add in the client applications | No need to add the service reference in the client applications |
Difference between WCF and Web service
Web service is a part of WCF. WCF offers much more flexibility and portability to develop a service when comparing to web service. Still we are having more advantages over Web service, following table provides detailed difference between them.
Features | Web Service | WCF |
---|---|---|
Hosting | It can be hosted in IIS | It can be hosted in IIS, windows activation service, Self-hosting, Windows service |
Programming | [WebService] attribute has to be added to the class | [ServiceContraact] attribute has to be added to the class |
Model | [WebMethod] attribute represents the method exposed to client | [OperationContract] attribute represents the method exposed to client |
Operation | One-way, Request- Response are the different operations supported in web service | One-Way, Request-Response, Duplex are different type of operations supported in WCF |
XML | System.Xml.serialization name space is used for serialization | System.Runtime.Serialization namespace is used for serialization |
Encoding | XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom | XML 1.0, MTOM, Binary, Custom |
Transports | Can be accessed through HTTP, TCP, Custom | Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom |
Protocols | Security | Security, Reliable messaging, Transactions |
I appreciate your blog ,Very Nice
ReplyDelete.Net Online Training
I agree with every verdicts made on this subject. It is really very interesting. Thanks for sharing.
ReplyDeleteMiracle II Neutralizer Gel
perde modelleri
ReplyDeletemobil onay
mobil ödeme bozdurma
nft nasıl alınır
Ankara Evden Eve Nakliyat
TRAFİK SİGORTASI
DEDEKTOR
Kurma Website
aşk kitapları