Monday, January 25, 2010

Advantages of using WCF over Web Services

WCF Supports Multiple Bindings like http,tcp,MSMQ etc where as web services uses only http
WCF can maintain transaction like com+ .
It can mainitain state .
It can be hosted on IIS,Selfhosting,Windows Servies(Windows Application Service) .
The development of webservice with ASP.net relies on defining data and relies on the XMLSerializer to transform datato or from a service.
Key Issues of XML Serailizer to serialize .net Types with XML.
-Only Public fields and Properties of .net types can be translated to XML
-Only the classes which implement IEnumerable Interface can be translated to XML.
-Classes implementing IDictionary Interface such as Hash table cannot be serialized.

WCF Uses DataContractAttribute and DataMember Attribute to Translate .net types to XMl.
-DataContract Attribute can be used for classes and structures-DataMember Attribute to Field or Property
Diference between DataContractSerailizer and XML Serializer is
-DCS has better performance over XML Serialization
-XML Serialization doesn't indicate which field or property of the type is serialized, DCS Explicitly shows which field or property is serialized
-DCS can serialize classes implementing IDictionary interface(Hash Table)

Exception Handling
In ASP.NET Web services, Unhandled exceptions are returned to the client as SOAP faults.
In WCF Services, unhandled exceptions are not returned to clients as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to clients for the purpose of debugging.

No comments:

Post a Comment