A message choreography is an organized set of message exchanges that represents one logical operation. We participate in a type of message choreography when we buy our spouse or significant other a gift using a credit card. The logical operation of making the purchase is composed of several message exchanges that include the following:
The store sends information to a merchant service.
The merchant service sends data to the bank.
The bank sends an approval code.
Each of these data exchanges is not terribly interesting on its own, but when viewed together, they represent one logical operation.
Message choreographies play a key role in service-oriented applications, particularly in the areas of security, reliability, and transactional capability. As you saw in Chapter 1, “The Moon Is Blue,” providing these features without dependencies on a particular transport requires us to place more information in messages. It is important to note, however, that we must also define how messages flow between participants. When providing message-centric security, we must consider how the sender and receiver will sign and encrypt data. When providing reliability, we must consider how the receiver will communicate to the sender which messages have arrived. Likewise, with transactional processing, we must consider how participants in the transaction can indicate whether actions have successfully been committed. All of these considerations require a well-defined set of message choreographies.
Among other things, many WS-* specifications define choreographies that are used to provide security, reliability, and transactional capability. WCF contains types that understand these WS-* choreographies, and as a result, it is possible to provide security, reliability, and transaction capability in our WCF applications without a dependency on a particular transport.
We are also free to define our own message choreographies. These choreographies can describe business processes, rules to a game, or particular functionality in a message exchange. While it is technically possible to author WCF components that provide our own custom choreographies, the process is tedious, especially with more complex choreographies. Tools like Microsoft BizTalk Server and WF are typically better suited to the task.