
Behavior Extensions and BizTalk Server
One of the featured deliverables for the R2 release of BizTalk Server is the set of WCF adapters. These adapters allow BizTalk Server to call existing WCF applications from an orchestration, or to expose an orchestration as a WCF service to be called by a client. Orchestrations are not required for WCF adapters to interact with WCF because you can use pure WCF messaging with a receive location and a send port. However, with the BizTalk WCF Service Publishing Wizard you typically will expose an orchestration with a WCF adapter.
By configuring a WCF adapter to use a WCF custom behavior, the behavior functionality will be invoked when the call comes into the BizTalk adapter. If the behavior’s processing of the message does not result in a positive response, the message is not allowed to be posted to a receive location. The message thus gets rejected at the transport level and is not preserved. For instance, you could check the identity of the caller posting the message to the BizTalk receive location against a list of allowed groups. The administrator can configure the group names in the property pages of the WCF behavior tab. The behavior custom code can read those groups and check access against the groups with which the identity is associated. The identity of the logged-in user is sent as part of the WCF call in the SOAP headers. That identity can be authenticated at either the transport layer or the message layer depending on the configuration. If that identity is in one of the allowed groups, the call is allowed to pass through to the receive location.
WCF custom behaviors are connected to BizTalk Server though the WCF Adapters configuration options in the BizTalk Server Administration console.
To allow the custom behavior to be visible to the WCF adapter’s configuration, you must add an entry similar to the following in the <extensions> section of the machine.config file:
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="BizTalkAuth" type="Microsoft.Samples.BizTalk.Adapters.WCFAuthorization.BizTalkWCFAuthElement, WCFAuthorization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=85b32fccee4970f5"/>
</behaviorExtensions>
<extensions>
<system.serviceModel
The name BizTalkAuth is given in the preceding section and will be used to subsequently identify the service extension inside the WCF adapter’s property pages. The type is a combination of the namespace of the behavior assembly (Microsoft.Samples.BizTalk.Adapters.Authorization), and the class (BiztalkWCFAuthElement) that derives from BehaviorExtensionElement. This is a class that represents a configuration element and its subelements that define behavior extensions to allow service behaviors to be customized. WCFAuthorization is the name of the assembly along with its public key token, as they exist in the GAC.