More goodness up on http://wcf.netfx3.com: the WCF RSS Toolkit is up! You can download the source from here.
Practically speaking, this toolkit gives you a framework for easily exposing your server-side data as RSS 2.0 or Atom 1.0 feeds. If you have some data somewhere (in a object graph, a SQL query, or anything that you can slap [DataContract]/[DataMember] on), you can use this framework to syndicate that data to the outside world.
The model here is that an RSS feed is just an interesting type of WCF service. It exposes endpoints, and those endpoints have the {Address, Binding, Contract} characteristics of any other service. There are a couple of interesting differences:
- Address: the address here is just the feed URI -- almost always an HTTP URI that you can GET with a browser or an aggregator
- Binding: Syndication uses a SOAPless binding -- HTTP + plain old XML
- Contract: HTTP GET + your syndication format of choice
But at the end of the day, it's still just a WCF service which means that you can host it in all the places you can host WCF services -- which is to say, you can expose RSS feeds from anywhere you can run managed code.
The full source for the toolkit is available, so aside from being highly useful this sample should also be highly informative. If you're interested in WCF extensibility, this is a great chance to see how some of the more esoteric extensibility points can be used in a real scenario. There's also some really handy extensions that are useful in all sorts of "webby" scenarios, RSS/Atom notwithstanding. Specficially, this sample has:
- A POX encoder. We'll have one of these in the box by RTM, but here's something you can use now.
- A URI Suffix Dispatcher. This allows ASMX-style GET dispatching, where some additional dispatch metadata is tacked on to the endpoint URI.
- A Query String formatter. Allows us to pull primitive values out of the URI query string and map them internally to parameters that get passed to your implementation method.
- A Message Transform Behavior that allows arbitrary XSLT transformations to be applied to a message as it flows out of the system.
Yasser really outdid himself here -- I think this sets the record for the largest WCF sample we've ever posted. Check it out, play with the bits, and send us your feedback!
