|
Get Acquainted With SOA and Indigo (Continued)
Take Advantage of Other Features
On top of the core communication capabilities, a feature known as reliable sessions provides robust messaging, with automatic retry and recovery if communication is disrupted. With reliable sessions, your program can determine for sure whether messages make it to their destinations successfully. Simply specify the assurances you need, such as exactly-once, in-order delivery. Reliable sessions also provide the mechanics for clients and services to maintain sessions.
WCF's queuing provides first-in, first-out (FIFO) messaging. Queuing allows programs to work with a pull model rather than a push model. The queuing service integrates with Microsoft Message Queuing (MSMQ). Queuing allows you to store messages durably—an important capability for building reliable, recoverable messaging solutions. Queuing also allows programs to be time-independent of each other in their communication.
The service runtime manages the execution of services. You can specify runtime behaviors through attributes or configuration settings. Instancing behavior determines how many instances of a service are created for clients. Concurrency behavior controls thread synchronization. For example, a service can indicate that its instances are not thread-safe. Throttling behavior allows you to put limits on the number of connections, sessions, and threads. Error handling behavior controls how errors are handled and reported to clients.
Service orientation discourages the use of objects as a way to connect programs, but object-oriented programming remains important to developers. WCF treats objects as first-class citizens. Serialization converts objects to and from XML. Serialization honors the "no classes and types" tenet of service orientation by converting objects to XML schema for transmission. Deserialization performs the reverse steps on the receiving side. When you access typed services, the serialization and deserialization of parameters and return values is completely automatic. You can also perform serialization on demand in code explicitly.
Security is a major concern in any development environment, and WCF introduces a wide range of new security features. These include client authentication, server authentication, message integrity, message confidentiality, replay detection, and role-based access control. Message integrity ensures that messages aren't tampered with. Message confidentiality makes sure that only authorized parties can read the messages. Replay detection prevents a hacker from capturing and retransmitting messages. Multiple security mechanisms are supported, including X.509 and integrated Windows security.
Services indicate their security needs through declarative attributes, code, or configuration settings. Security environment information, such as certificate locations, is determined at run time through configuration files. For common security configurations, developers can take advantage of turnkey security by specifying predefined bindings for common scenarios.
Transactions ensure that related operations occur as an atomic unit, in which everything succeeds or everything fails. WCF provides a centralized transaction system. In the past, transaction technologies were available for database processing and components, but there were too many ways of doing things. WCF provides a single transaction system that supports traditional transactional work, such as database processing and transacted communication.
The programming model makes transactions easy to use. This code shows you how to implement a transaction around communication with two services:
using (TransactionScope scope =
new TransactionScope())
{
mortgageService.SubmitMortgageApplication(
mortgageApp);
insuranceService.SubmitInsuranceApplication(
insuranceApp);
scope.Complete();
}
Services can flow transactions to other services. This allows enterprises to perform transactional work across platforms.
You can host WCF services in many kinds of environments, including Windows Forms applications, console applications, and Windows service applications (also called Windows NT Services). You can also host them with IIS, which allows services to be registered for automatic activation the first time a client attempts to access them. When a message arrives for a service that is not already running, it is launched automatically. IIS hosting also provides a reliable environment for services. Services are restarted if they enter an unhealthy state. If a service is updated, IIS hosting brings the new version online gracefully.
The sum of these features gives you a lot more options for building service-oriented applications more quickly and easily. Modern applications are connected applications. Service orientation treats connected applications as a cooperating set of message-oriented programs called services. Services expose service descriptions in WSDL and a collection of end points. Services contain contracts, bindings, and end points. Service contracts define the operations a service can perform. Bindings define how a service communicates with the outside world. Endpoints define the access points to a service.
About the Author
David Pallmann is a principal consultant with Neudesic. He has more than 25 years of experience in designing and developing software, much of it related to distributed computing. Reach him at .
Back to top
|