Silverlight 2, REST and WCF

Yi-Lun Luo has posted a great example in the forum about creating RESTful WCF services, click here to read the complete thread.

Useful links:

 

If you are interested in this subject, I also recommend the reading of this book by John Papa:

data20services20with20silverlight20220-20amazon20cover_-20small

Silverlight, SOAP Headers, WCF and asmx services

As reported by the Web Services Team, Silverlight 2 supports custom SOAP headers

A good working example can be found here, but it only uses WCF services, what about the “old” asmx ones?

I’ve modified the “SilverlightHeaders” solution to use both WCF and asmx, using OperationContext in the first case and HttpContext in the last, click here to download the complete solution.

WCF DataContract Serializer and IsReference property

One of the new features of .NET framework 3.5 SP1 is the possibility to serialize an object graph with circular references by using the standard xsd:ID/xsd:IDREF attributes.

Just mark your DataContract attribute with the IsReference=true property:

    [DataContract(IsReference=true)]

    public class Room

    {

        [DataMember]

        public string description { get; set; }

        [DataMember]

        public Devices roomDevices { get; set; }

    }

 Check out this post by Zulfiqar for more examples.

WCF REST Starter Kit Preview 1 available on CodePlex

“The WCF REST Starter Kit is a set of features, Visual Studio templates, samples and guidance that enable users to create REST style services using WCF. The CodePlex Preview 1 release provides new features that enable or simplify various aspects of using the http capabilities in WCF, such as caching, security, error handling, help page support, conditional PUT, push style streaming, type based dispatch and semi-structured XML support. The WCF REST Starter Kit also provides Visual Studio templates for creating REST style services such as an Atom feed service, a REST-RPC hybrid service, Resource singleton and collection services and an Atom Publishing Protocol service. In addition, there are samples, documentation and other guidance that help to use these new capabilities.”

http://www.codeplex.com/aspnet/Wiki/View.aspx?title=WCF%20REST

More information are available here.