Reading data and RSS with Silverlight and no cross-domain policy| Comments
- | Posted in
- cross domain
So you want to read an RSS/Atom feed on the interwebs and saw the SyndicationFeed class you could use in Silverlight to give a nice RIA display of the syndicated data. Great, no problem right, just wire up an WebClient, point it to the RSS feed on something like http://silverlight.net or something and boom, done. Wait, what’s this 404 Not Found error? In most cases this is going to be a result of a cross-domain issue. If you haven’t started working with services yet, Silverlight requires a cross-domain policy file to be in place to access remote data not on the same site-of-origin of the Silverlight application.
If you want to learn more about this in further detail you can read this and view this.
Crap. So now what do you do? You don’t have a server that would enable you to write a proxy service and you don’t really have the time to do that. Aha, enter some free services for you!
First, depending on what you are trying to do with the data, give Popfly a look. Popfly contains several templates for importing syndicated information and displaying it in different visualizations. For instance in about 4 clicks I can import an RSS feed, connect it to a visualizer and have this:
Popfly is no longer available as a service from Microsoft.
Feedburner and Yahoo! Pipes
Pipes is similar to Popfly but doesn’t really provide a breadth of possibilities of visualizations and ease of mashup of way different types of sources, but for this purpose I think it works well. In Pipes, you can create an input feed and map it to an output, even merging various sources together. The end result can be a new RSS feed for you. And Yahoo Pipes already has a cross-domain policy file in place for Flash (which Silverlight supports). You have to change your endpoint URI a little bit and it wasn’t clear until I searched, but for example, here is a RSS feed URL you could use for combining my blog and the Silverlight community blogs in one.
Feedburner is a syndication service that does a lot of statistics of your feed, helps you manage subscriber data and can save you some bandwidth as well. It does RSS really well (and enclosure support, etc). Best of all, it also supports cross-domain policies via the Flash format (again, which Silverlight supports).
So if you find a feed that is on a site without cross-domain policy support, you can create a new Feedburner feed, Yahoo Pipe or Popfly mashup and be good to go!
A subtle workaround for getting data from sites that aren’t providing the policy files :-)
Hope this helps!
Please enjoy some of these other recent posts...