Thursday, December 31, 2009

Accessing a crossdomain Feed from a client application (Silverlight/Flash) using Yahoo Pipes

One of the cool features of Silverlight 3 is the support for cross-domain web requests. This enables you to call web APIs directly from your Silverlight client without proxying the request through your own server. The service you’re calling must provide a policy file permitting cross-domain callers. This is the same security mechanism used by Flash to make cross-domain calls, and in fact Silverlight 3 respects the same crossdomain.xml format as Flash. Any service callable by Flash is now callable by Silverlight 3.

Several popular Web 2.0 services, like Flickr, have a crossdomain.xml file that allows for cross-domain Silverlight clients. Others, like Twitter,Google News have a more restricted crossdomain.xml file that only allows callers from certain domains. Most sites however don’t provide a crossdomain.xml, so for instance if you want to consume their RSS feed you need to proxy the request through your server.

Today I started on a new Silverlight project where we want to consume RSS feed, and I was just thinking to add my “standard” WCF proxy to the project then I got the information about yahoo pipes from google .  Yahoo Pipes is a really cool service that let’s you define fairly complex web integrations using drag-and-drop. You drag different sources, filters and operations on a design service and “connect” the pipes together to pipe and transform the data. When I checked http://pipes.yahoo.com/crossdomain.xml I was a little disappointed to get a 404, but after digging around a little it turns out Yahoo host their APIs on a different URL: http://pipes.yahooapis.com/crossdomain.xml. Yahoo Pipes supports cross-domain callers!

I quickly created a really simple pipe. It uses the Rss Feed url of google news, then gives the output and a url of pipes.yahoo.com , just change 'yahoo' to 'yahooapis'.... Now you got a link which you can use in your flash or silverlight application to access the crossdomain feeds directly..

No comments:

Post a Comment

Send Free SMS