I’ve been looking into Windows Communications Foundation (WCF) functionality, specifically focusing on client features for .NET and Silverlight clients, as a foundation for creating business applications.
So why wouldn’t I just use the WebClient or HttpWebRequest classes? These classes are simple to understand and use. And they don’t introduce the complexity of the WCF framework.
This is true, of course, but WCF offers flexibility that business applications require to implement additional management and interoperability features. Specifically, WCF offers a host of extensibility points that business applications can make use of, such as custom validation, service logging, and data manipulation.
This flexibility is also important where business applications have to rely on outside services. Third-party REST and SOAP services are more ubiquitous and integrating with these services is a common business requirement. These services are a "black box" and your application must manage change that is beyond your control.
Here are a few links to information related to WCF client functionality:
- WCF offers a host of extensibility points, but I am currently focusing on WCF client applications.
- Since Silverlight is a lightweight version of the .NET runtime, many of the WCF features available to .NET applications are not available to Silverlight applications, though Silverlight does provide some helpful features to access web services. There are some additional examples on MSDN in the Silverlight Web Services Samples project.
- The WebHttpBinding class, along with the WebGet and WebInvoke attributes, can be used to access REST services. Unfortunately, this binding doesn’t exist in Silverlight.
- Silverlight only supports asynchronous service calls, so service contracts must be transformed to use an asynchronous signature.
- Even though Silverlight doesn’t support it out of the box, WCF features can be used to access both REST/POX services and JSON services.
- You don’t have to automatically generate a proxy for your service in Silverlight. You can define (or share) your service contracts within Silverlight and use the Channel Model to access the service.
- There is a WCF REST Starter Kit, but as of this writing it is still in Preview 2 state and hasn’t been updated in over a year.
- In the MSDN Code Gallery, there is a Web Application Toolkit for REST Services that provides some REST functionality.
So I hope to post some code examples soon exploring some aspects of WCF client programming.
Leave a Reply