By Adnan Masood | 5 Feb 2008 | Unedited contribution
The Code Project
Windows Communication Foundation with its 3.5 release provides several new and useful features including capability to publish and consume syndication feeds in a much easier and uniform way, right out of the box. This article focuses on using the WCF 3.5 libraries namely System.ServiceModel.Syndication namespace to create and publish an RSS and Atom feed from the same code base.
Syndication feeds are data formats to provide users with contents which updates frequently without them having to visit the corresponding websites individually. Atom and RSS are two popular syndication formats. This feature helps readers to keep up to date with their favorite websites in an automated fashion instead of checking each of them manually. This method of syndication is quite popular with blogs, news headlines and podcast to name a few content providers.
RSS (Really Simple Syndication) is a popular web feed format containing either the summary or full text of associated contents. Another format for web feeds is Atom which differentiates itself in terms of content model, date Format, internationalization and modularity from RSS. Details of these formats and their comparison are beyond the scope of this writing but it can be found on the links citied in the reference section.
As we’ve established above, RSS and Atom are suitable for more content oriented entities and therefore it raises an important question of why do we need web feed support in a connected application development framework like WCF? The answer lies in one word, REST (Representational State Transfer). Briefly speaking, by introducing the webHttpBinding and UriTemplates, Microsoft has depicted their interest and paradigm shift towards the Web 2.0 model of REST style services. Asp.NET MVC framework is also closely tied with the REST style development. The Syndication support is among the core component supporting the big plan which constitutes of
Web feeds get parameterized and treated as a service.
The request and response over HTTP-GET is based on standard web feeds format, utilized by a wide variety of aggregators.
Underlying WCF libraries provide built in support for UriTemplate parsing and hence leveraging the “hole in the Uri” pattern over HTTP-GET for service invocation.
WCF 3.5 provides built in syndication support for standardized web feed format responses hence supporting parameterized Uri over multiple end points.
An example which follows shortly will clarify the above mention points.
System.ServiceModel is the new namespace provided with WCF 3.0 and now with WCF 3.5, Microsoft has added few more namespaces to it and ServiceModel.Syndication namespace is one of them.
Some of the prominent classes of System.ServiceModel.Syndication are as follows.
(De)Serializes a SyndicationFeed instance in Atom 1.0 format.
(De)Serializes a SyndicationFeed instance in RSS 2.0 format.
Base class for representation of syndication content.
Represents a top-level feed object both in Atom 1.0 and RSS 2.0.
Abstract class serving as base class for formatters (Atom10FeedFormatter, Rss20FeedFormatter).
Represents a feed item, for example an RSS or an Atom.
Represents any SyndicationItem content intended to be displayed to an end user.
Represents syndication content that consists of a URL to another resource.
Represents XML syndication content which is not intended to be displayed in a browser.
For the rest of this enlightening article, please click on the link for this blog post's title above.