Rants Tagged with “WCF”

1    (Total Pages: 1/Total Results: 6)

Silverlight and Cross Site Scripting

If you have spent anytime with Silverlight, you've likely run across the cross-site scripting issue.  Essentially, the browser doesn't let you do web requests from other sites than the one you're hosted in.   This is to prevent nasty script kiddies from doing nefarious things. 

While I hope that Microsoft solves this in the way that Flash does (essentially a white-list that is located on the server that says what sites are ok), I do suggest a workaround: proxy calls offsite through your server.  You can create a simple service on your site that returns data from another site. Then in Silverlight its a matter of making a request up to your own server to get the data and work with it in whatever way you want.

Luckily with .NET 3.5 and WCF's new REST stack, this is really easy.  For example, here is a simple WCF service using the new WebGet attribute to specify that it can be called like a REST service:

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(
       RequirementsMode = 
            AspNetCompatibilityRequirementsMode.Allowed)]
public class Service
{
  // Add [WebGet] attribute to use HTTP GET
  [WebGet(ResponseFormat=WebMessageFormat.Xml)]
  [OperationContract]
  public XElement DoWork()
  {
    return XDocument.Load("http://wildermuth.com/rss").Root;
  }
}

The trick here is to add the WebGet attribute to your method.  Note I am specifying that I want XML (JSON is the default) so I can get the data back to Silverlight as XML. As a return type I am specifying XElement (XDocument may make more sense but its not Serializable) so we load a XDocument and just return the root of the document.  Voila, a service you can call from Silverlight to call out to another service.

I could have changed this to accept a parameter with the request to make and I didn't do this on purpose.  You can imagine if you leave an open relay like that open, you're inviting script kiddies to do nasty things. 

What do you think?

ASP.NET AJAX RTM and WCF Do Not Play Well Together...

I am delving into WCF and AJAX (not at the same time) lately so I wanted to see if they were compatible.  According to this whitepaper on ASP.NET (follow the link and scroll down to "Support for WCF Web Services"), the RTM of AJAX does not support WCF.  It seems they removed it so they could make it work better in a later release.  The promise is that by the Orcas release of VS, they will be compatible. 

This further cements my opinion that releasing .NET 3.0 without FULL tool and compatibility is nonsense. Without a good across the platform support (e.g. WCF and ASP.NET stack working well together), a workable WPF editor (Cider is horribly broken currently...change the default editor for XAML to XML, you'll be happier), and projects that actually compile out of the box (WPF projects don't compile currently without some hand-editing of the XAML). Microsoft has always been about tools more than technology, that's why I've been with them so long.  If we need to cruft together a bunch of installs to make stuff work, I'd be doing that in Java and Linux.

It looks like most .NET 3.0 development should wait until late 2007 when Orcas ships...but that's just my opinion...

.NET 3.0 Visual Studio Extensions ("Orcas") Compatible with Vista RC

Come and get it.  The newest drop of the Visual Studio Tools for .NET 3.0. Make sure you get the .NET 3.0 Runtime (and SDK) and the Visual Studio Workflow Tools RC5 while you're at it! 

NOTE: No WCF Designer in this drop and Cider (the WPF designer) doesn't work in VS Express.

Vista and WinFX

I have built a test-vista machine to do some WinFX stuff on and it got me wondering...why do I need to run the WinFX runtime installation on Vista? Isn't this supposed to be pre-installed?  Aren't some built-in Vista apps already using WinFX?  I am so confused.  Anyone know?

 

New Indigo/Avalon Bits work with VS Beta 2

And they're up on MSDN!  Wahoo!

NDAzed and Confused...

The PDC talk is heating up and it is clear to me that there is a huge number of 'wow' features that will be unveiled in LA. It seems like most of the other bloggers are talking about what I think is protected behind the multitude of NDA's I've signed. So to be safe I am keeping my mouth shut...tightly. What I can say is that what you'll see at the show about Whidbey, Yukon and Longhorn are phenomenal. Some of it is evolutionary, but much of it is revolutionary. I think you’ll be pleased... I am.

Since Don (Box) can’t seem to not talk about it, Indigo has gotten me really intrigued. I haven’t seen any of it, but I really want to know everything I can about it. That’s where I will spend my time at the PDC.

On a more mundane note, it looks INETA is going to be fielding its own band at the PDC. So far I know its Richard Hale Shaw, Carl Frankin and I. But I expect it to be a blast a number of people to come out of the woodwork to play.

In the last four years, I have been so heads down in my writing, developing and spelunking that I have neglected my own music ramblings (see http://mp3.com/shawntwain). The PDC has given me a reason to spend some time tuning up the old fingers.