Feeds

Silverlight 2.0 data and web services explained

Mashups and large downloads challenge

Intelligent flash storage arrays

Mix 08 Microsoft Silverlight team member Eugene Osovetsky has explained to a packed Mix 08 session how Silverlight 2.0, released as beta on Wednesday, interacts with external data and web services.

No surprise: the first thing we saw was based on the Windows Communication Foundation (WCF), Microsoft's universal .NET web services API.

Presuming you use ASP.NET and Visual Studio, this involves creating a WCF service by marking up .NET code with attributes such as ServiceContract and DataContract, then consuming the service in a Silverlight application by adding a Service Reference and coding against it. Silverlight requires AJAX-style asynchronous calls to a proxy class, with the results processed in a callback event handler. Silverlight has rich bindable data controls including a listbox and a datagrid.

That's all well and good, but not everyone wants or can use end-to-end .NET. Fortunately Silverlight also supports standard SOAP by importing a WSDL, or generic web services using XML or JSON, though a little more code is needed. Once again, the Silverlight code involves asynchronous calls, this time using a generic WebClient class that will already be familiar to .NET programmers.

There are complications with REST, though. The problem is that Silverlight, like Adobe Systems' Flash, does not have its own networking stack but relies on the browser's plug-in API. This gets you benefits like sharing the browser's authenticated connections, but also brings limitations.

Apparently it is simply not possible to use HTTP PUT or DELETE methods, a problem that leads to hacks like HTTP POSTs that delete data, breaking the HTTP specification. This is not the fault of Silverlight, but it is unfortunate. For similar reasons, there is no access to SOAP fault messages.

There is also a big issue with cross-domain data sources, which poses a problem for mash ups. Cross-domain access is prevented by default for security reasons. Otherwise, a bad Silverlight application might hijack an existing authenticated connection to some other site.

Cross-domain data is the essence of mash ups, though. The solution with Silverlight is that services can opt in to being called cross domain by including a policy file. Silverlight has its own, or will observe a Flash policy file. Therefore, public services that work with Flash should also work with Silverlight. Cross-domain access over SSL is promised, but not supported in the current beta.

Osovetsky remarked that Silverlight 2.0 has moved away from JSON towards SOAP, saying that JSON has little advantage if the client code is not JavaScript, though he admitted that JSON has a smaller message size. Microsoft is investigating binary XML for Silverlight, but it seems unlikely this will make the first release.

This puts Silverlight at a disadvantage to Flash for downloading large amounts of data, since Flash can use Adobe's efficient ActionScript Message Format. In mitigation, Silverlight is inherently flexible and there is plenty of scope for custom solutions.®

Remote control for virtualized desktops

More from The Register

next story
Be real, Apple: In-app goodie grab games AREN'T FREE – EU
Cupertino stands down after Euro legal threats
Download alert: Nearly ALL top 100 Android, iOS paid apps hacked
Attack of the Clones? Yeah, but much, much scarier – report
You stupid BRICK! PCs running Avast AV can't handle Windows fixes
Fix issued, fingers pointed, forums in flames
Microsoft: Your Linux Docker containers are now OURS to command
New tool lets admins wrangle Linux apps from Windows
Bada-Bing! Mozilla flips Firefox to YAHOO! for search
Microsoft system will be the default for browser in US until 2020
Facebook, working on Facebook at Work, works on Facebook. At Work
You don't want your cat or drunk pics at the office
Soz, web devs: Google snatches its Wallet off the table
Killing off web service in 3 months... but app-happy bonkers are fine
prev story

Whitepapers

Choosing cloud Backup services
Demystify how you can address your data protection needs in your small- to medium-sized business and select the best online backup service to meet your needs.
Getting started with customer-focused identity management
Learn why identity is a fundamental requirement to digital growth, and how without it there is no way to identify and engage customers in a meaningful way.
10 threats to successful enterprise endpoint backup
10 threats to a successful backup including issues with BYOD, slow backups and ineffective security.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
The hidden costs of self-signed SSL certificates
Exploring the true TCO for self-signed SSL certificates, including a side-by-side comparison of a self-signed architecture versus working with a third-party SSL vendor.