WCF Essentials from MSDN

 

Getting Started with WCF

This section will serve as a summary of the steps you will take to design, implement, host and consume WCF services. The purpose is not to explain the details behind each design choice or feature – but to make you aware that these are things you should consider. Later sections of this whitepaper will provide recommendations to narrow the choices you face.

WCF Templates and Tools

This section summarizes the available project templates, when to use each; and discusses the limitations and benefits of the core WCF tools.

…more articles here…

A WCF RESTful service using ASP.NET MVC using REST MVC SDK

Hybrid choice that blends ASP.NET and WCF. The WCF team saw that many developers building ASP.NET MVC apps are more comfortable with the ASP.NET MVC programming model, but still want to supply more rich RESTful services from their web applications. So the WCF team put together an SDK and samples for building REST services using ASP.NET MVC.

You can download the samples and SDK from ASP.NET MVC 1.0 page on CodePlex.

Do read through the overview document as it describes the changes you’ll need to make to an application to make use of this framework. Also, the zip file includes several sample movie applications which demonstrate various scenarios and compares them to the baseline of not using the REST approach.

Via Rest For ASP.NET MVC SDK and Sample

When to use ASP.NET MVC to build out REST-ful services and when to use WCF

A common question that comes up is when to use ASP.NET MVC to build out REST-ful services and when to use WCF?

when the only reason for the service’s existence is to service the one application you’re currently building, it may make more sense  would stick with the simple case of using ASP.NET MVC. This is commonly the case when the only client to your JSON service is your web application’s Ajax code.

When your service is intended to serve multiple clients (not just your one application) or hit large scale usage, then moving to a real services layer such as WCF may be more appropriate.

Via Rest For ASP.NET MVC SDK and Sample

WCF REST Starter Kit Preview 2

 

Preview 2 of the starter kit introduces a second set of client-side features for accessing WCF and third-party REST services from within .Net applications. The new HttpClient class provides the REST developer with a uniform extensible model for sending HTTP requests and processing HTTP responses, in a variety of formats. The new "Paste Xml as Type" Visual Studio add-in enhances the serialization support in HttpClient by generating serializable types based on XML examples or XSD schema.

Download here

Creating and consuming Rss/Atom syndication feed using WCF 3.5

 

The .NET Framework did not provide any built-in functionality for creating or consuming syndication feeds until version 3.5 with the introduction of the System.ServiceModel.Syndication namespace. The most germane class in this namespace is SyndicationFeed. As you can probably guess from its name, this class represents a syndication feed. It has properties like Title, Description, Links, and Copyright, which provide details about the feed. The content items that make up the feed are specified via the Items property, which is a collection of SyndicationItem objects. The SyndicationFeed class also has a static Load method that parses and loads the information from a specified RSS 2.0 or Atom 1.0 syndication feed.

In addition to the SyndicationFeed and SyndicationItem classes, the System.ServiceModel.Syndication namespace also includes two formatter classes, Atom10FeedFormatter and Rss20FeedFormatter. These classes take a SyndicationFeed object and generate the corresponding XML content that conforms to either the Atom 1.0 or RSS 2.0 specificiations.

More… How to create a syndication feed for your website

What’s inside the WCF REST Starter Kit

  • Visual Studio Project Templates image
    • REST Singleton Service produces a service that exposes the full HTTP interface (GET, POST, PUT, and DELETE) around a singleton resource, and it automatically provides both XML and JSON representations for the underlying resource.
    • REST Collection Service similar to the REST Singleton Service only it also provides support for managing a collection of SampleItem resources.
    • HTTP Plain XML Service provides ONLY the GET and POST operations for those who don’t care about fully conforming to the RESTful design  and would rather build a REST/RPC hybrid service by overloading GET and POST using the HTTP Headers.
    • Atom Feed Service template provides a sample implementation that shows how to programmatically generate and return a SyndicationFeed instance.
    • Atom Publishing Protocol Service template produces a full-fledged AtomPub service capable of managing collections of resources as well as media entries.
  • WebProtocolException allows you to directly set your HTTP status code.
  • WebServiceHost2/WebServiceHost2Factory which provides a zero-config experience. Provide support for Help Page.
  • Help Page and using [WebHelp] for annotation. Simply navigate to /help image
  • [WebCache]
  • RequestInterceptor
  • Added Extension methods to the WebOperationContext class.

You can download the WCF REST Starter Kit here.

For samples of using the starter kit, look at this A Developer Guide to the WCF REST Starter Kit.

A Tutorial on Building RESTful Web Services with WCF 3.5

 

  • [WebGet], [WebInvoke] to define mappings for the Http Methods Interface
  • UriTemplate to map objects to method signatures through WebGet/WebInvoke Attributes image image
  • WebOperationContext to access the HTTP Request/Response including header and status code
  • <%@ ServiceHost Factory=”WebServiceHostFactory” to auto-config the Web endpoints binding and behavior without edit web.config.
  • aspNetCompatibilityEnabled(web.config) & AspNetCompatibilityRequirements(.cs) to access HttpContext
  • (optional) using Microsoft URL Rewrite Module for IIS 7.0 to remove the .svc from the URIs.
  • RequestFormat/ResponseFormat=WebMessageFormat.Xml/WebMessageFormat.Json through WebGet/WebInvoke Attributes.image
  • WebScriptServiceHost to auto-generate a Ajax-friendly JSON javascript proxy for web browsers. Append /js to the end of base address to get to the proxy.
  • Use SyndicationFeed, SyndicationItem, SyndicationContent to build generic logical feeds.
  • Use Atom10FeedFormatter, RSS20FeedFormatterClass to turn a SyndicationFeed object to Atom/RSS specific feed format. Method can use SyndicationFeedFormatter base class to return various formatter object.  
    image 
  • Use ServiceDocument, ServiceDocumentFormatter, AtomPub10ServiceDocumentFormatter, and Workspace to generate AtomPub service document. note: AtomPub as a standard application of the HTTP uniform interface(GET/PUT/POST/DELETE) but applied specifically to Atom feeds, which are modeled as collections of entries.
  • Too tedious, try WCF REST Starter Kit. and you can download here.

Via A Guide to Designing and Building RESTful Web Services with WCF 3.5