• Reading data and RSS with Silverlight and no cross-domain policy


    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!

    Popfly

    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:

    Check it out…you may not need to do anything else!

    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!


    This work is licensed under a Creative Commons Attribution By license.

    Tuesday, June 03, 2008 10:32 PM

    PostTypeIcon

Comments.

  • Gravatar
    # re: Reading data and RSS with Silverlight and no cross-domain policy


    Great post Tim :)

    For an example app(RSS reader) using Yahoo Pipes as a cross domain proxy check out my post at http://jonas.follesoe.no/PermaLink,guid,52d330a9-2931-40dc-9320-01195b24996a.aspx

    Thanks for the Popfly and Feedburner tip! :)

    Best regards,
    Jonas Follesø
    Microsoft Regional Director, Norway

    6/3/2008 11:12 PM
  • ryan said:
    Gravatar
    # re: Reading data and RSS with Silverlight and no cross-domain policy


    There are two other ways around this as well. proxy services on your local server i.e. a php, aspx, python, ruby etc script that can grab the data for you (flash has the same cross domain policy issue) or just fake it out with a policy file injectoin or use a nocrossdomain policy proxy online.

    This dude did some work with this as well: http://franksworld.com/blog/archive/2008/04/17/10907.aspx

    6/4/2008 1:52 AM
  • timheuer said:
    Gravatar
    # re: Reading data and RSS with Silverlight and no cross-domain policy


    @ryan: yes, you can definitely write your own proxies, etc. -- i was hoping to point out that if you wanted a 'no additional code' approach you can do one of these options without having to write any additional code.

    6/4/2008 7:14 AM
  • ryan said:
    Gravatar
    # re: Reading data and RSS with Silverlight and no cross-domain policy


    Hey Tim,

    Yeh I figured that but I think that doing this directly from Flash or Silverlight always runs into problems, especially when you don't control the end point. i.e. if you are aggregating feeds, hitting lots of services etc. I was just adding to your good info in case anyone was looking. I know you have mentioned this stuff before here as well.

    I am pretty amazed though that people still have so many problems with cross domain and it should really be avoided with a proxy or architecture that can include a proxy as a fallback within the system.

    Great stuff on Silverlight 2 lately. I am really digging the skinning info.

    6/4/2008 10:42 AM

Your Reply.

  Comment Form  

Fields denoted with a "*" are required.

*Your name:
Subject:
Your blog:
Your email:  (will not be displayed)
*Your message:

 
Please add 7 and 8 and type the answer here: