R – What are the methods of communication between Silverlight and server side

communicationsilverlight

Background:
I have basically no experience in Silverlight, i was asked to start reading up on the tech and provide some insight for client which may want to rebuild the UI of their .Net Desktop application in silverlight. So my experience is what i have been able to google (which surprisingly is not easy) and the few tutorials i have done.
I am aware Silverlight could use ASMX Web Service , WCF Services or REST to do communications with the server.

Question:
Are there any other official or non-official mothods of communication anyone knows of?

Thank you in advance,
David

Best Answer

Start here:

http://msdn.microsoft.com/en-us/library/dd470099(VS.95).aspx

http://videos.visitmix.com/MIX08/T13

http://videos.visitmix.com/MIX09/T42F

I am somewhat biased having worked on the technology :), but I would urge you to consider WCF.

This method gives you great usability: It literally takes a few minutes to "Add New... Silverlight-enabled WCF Service" to your project and have everything up-and-running. In Silverlight 3, this uses a very performant binary XML protocol under the covers, which can be easily switched to regular text XML for debuging with just a 2-line config change. And it integrates nicely with most authentication models that you would want (see the security section in the doc link above).

Of course, you can roll-your-own communication using HttpWebRequest, WebClient, or even sockets. Using WebClient is probably best if you want to go with REST on the server. Keep in mind that some things that are normally possible in REST (such as using PUT and DELETE HTTP verbs) are not possible in browser plugins such as Flash and Silverlight due to browser restrictions.

Finally, there's .NET RIA Services. It's a bit too heavy-weight for some scenarios and doesn't have some of the WCF features (like binary and duplex), but it's more than just a way to communicate with the server: It gives you a whole perscriptive framework for building SL apps with server-side data, and gives you a lot of nice features like validation, paging, etc. for free.

Related Topic