Posts

Showing posts from February, 2009

WCF vs ASP.NET Web services

Introduction In this post I will explain the Difference between ASP.NET web service and programming WCF services like ASP.NET web services. It also discusses how we use the both technologies for developing the web services. The development of web service with ASP.NET relies on defining data and relies on the XmlSerializer to transform data to or from a service. Key issues with XmlSerializer to serialize .NET types to XML Only Public fields or Properties of .NET types can be translated into XML. Only the classes which implement IEnumerable interface. Classes that implement the IDictionary interface, such as Hash table can not be serialized. The WCF uses the DataContractAttribute and DataMemeberAttribute to translate .NET FW types in to XML. [DataContract] public class Item { [DataMember] public string ItemID; [DataMember] public decimal ItemQuantity; [DataMember] public decimal ItemPrice; } The DataContractAttribute can be applied to the class or a strcture. DataMemberAttribute can be a