Home > Microsoft .Net Development Tips > .NET Architecture > Beginning Windows Communication Foundation development, Part 3
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

.NET ARCHITECTURE

Beginning Windows Communication Foundation development, Part 3


Brian Eastwood, Site Editor
08.22.2007
Rating: --- (out of 5)


.NET Essentials Channel
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Windows Communication Foundation has been described as the most important of the .NET Framework 3.0 technologies. SearchVB.com has offered some insight into this SOA tool in two previous tips -- Beginning WCF development, Part 1 and, appropriately enough, Beginning WCF development, Part 2 -- and continues to do so with this tip.

We begin with A truly simple example to get started with WCF from Ralf Westphal. This blogger created his sample WCF service because everything else he had seen involved multiple files and multiple languages. Here, in 104 lines of C#, Westphal defines and implements the service, implements and runs the server, and implements the client. "That's my very simplest WCF example. It lets you play around with WCF in a single process. Or you can easily distribute the code across several assemblies," Westphal concludes.

From here, we're going to look at some key Windows Communication Foundation concepts one at a time.

Addresses: Quite simply, an address denotes where a service is located and where a SOAP message is headed; it, along with a binding and a contract, are defined in a service's endpoint. A recent MSDN article, WCF addressing in depth by Aaron Skonnard, offers a few hints for coding addresses.

First, Skonnard notes, there are two fundamental ways to specify an address -- as an absolute address for each endpoint or as a base address with relative paths for each endpoint.
More on Windows Communication Foundation
Beginning WCF development: Part 1 | Part 2

Programming SOA with WCF

Instance management, security in WCF

WCF Security Learning Guide
In addition, it is entirely possible to expose multiple endpoints for a service, if that service has different bindings; on the other hand, if you are exposing multiple endpoints on the same binding, then a single address will do. Finally, it might be worth considering custom address headers for SOAP messages, he says, "[i]n order to accommodate even more sophisticated routing and dispatching logic."

Caching: Caching is important to Windows Presentation Foundation services, as there is always a possibility that messages will be sent from the client faster than they can be processed by the service. It pays, therefore, to have a good caching strategy. Paul Glavich provides such a strategy in a recent blog post, Architecture, WCF Services and Caching. He summarizes it thusly: "Caching is easily implemented by overriding the virtual service method and providing only caching semantics, calling down to base services for actual data where required."

Claims-based security: Both role- and permission-based security models have their drawbacks, so Windows Communication Foundation has introduced a claims-based security model. "A claim describes an individual right or action applicable to a particular resource," Michele Leroux Bustamante writes in Building a claims-based security model in WCF, Part 1. "For example, an identity claim might describe a username, while a proof of possession claim might describe a role, a right to a particular resource, or some other useful information." That article, along with Building a claims-based security model in WCF, Part 2, outlines how to build a claims-based authorization model, implement and customize authorization policies, set permission demands, and work with both security and SAML tokens.

Performance counters: Want to get some real-time monitoring information for your WCF service? It is quite easy, and requires but three lines of code inputted through configuration, Nicholas Allen writes in Enabling Performance Counters. (Allen's blog, for what it is worth, is an excellent source of quick Windows Communication Foundation. The Channels tag and the Service Model tag might be of particular interest.)

WCF and the .NET Compact Framework: Recognizing that Web services and mobile devices, pardon the pun, go hand in hand, Microsoft is bringing a subset of Windows Communication Foundation to mobile devices. Roman Batoukov indicates in Windows Communication Foundation (Compact Edition) and the story of the Lunch Launcher will be limited to channel layer messaging and, therefore, will not offer service model support on mobile devices. This is because, by and large, mobile devices users tend to use email as their message transport channel, Batoukov suggests.

Additional information on Windows Communication Foundation and mobile devices can be found in Mark Prentice's Introduction to WCF for the .NET Compact Framework Messaging Stack. This provides a "Hello World" example using HTTP requests and demonstrates how to create a helper class, create and open a channel, send the message and set up the server to respond to it.

WCF for non-HTML endpoints: We end with a tidbit that addresses XML-RPS, which it the common API for blogging software. That calls for an XML-RPC implementation on Windows Communication Foundation. Writes Clemens Vasters in XML-RPC with WCF:

My XML-RPC implementation is a binding with a special encoder and a set of behaviors. The Service Model programming experience is completely "normal" with no special extension attributes. That means you can also expose the XML-RPC contracts as SOAP endpoints with all the advanced WCF bindings and features if you like.

Vasters adds that this prototype should be available in the main code base for the .NET Framework 3.5.

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Web services and SOA implementations in the .NET Framework
Outgoing Bill Gates says UML on tap in Oslo SOA modeler
Podcast: Windows CardSpace authors speak
Open XML SDK ready for the road
Some of the Zen of Volta
Scaling WCF applications can challenge development teams
Security interoperability with .NET/WSE and WebLogic Workshop 8.1
Book excerpt: Hands-on Windows Communication Foundation
A SOA versioning covenant
.NET Framework 3.5: Communication, database improvements abound
New JMS adaptors target .NET, BizTalk Server apps

.NET Architecture
Designing Windows Communication Foundation service contracts
Book excerpt: Java EE and .NET security interoperability
Book excerpt: .NET Framework Design Guidelines
Book Excerpt: Executing activities in Windows Workflow Foundation
Aspect-oriented programming (AOP) and the .NET Framework
Book excerpt: Hands-on Windows Communication Foundation
The Software Factory: Refactoring an industry
A SOA versioning covenant
Localization practices for .NET 2.0: It's still about the architecture
The fallacy of the data layer -- or, a new architectural model for software designs

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
scripting language  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts