Logo
CAR REVIEW
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Server

Microsoft BizTalk 2010 : Consuming ASDK-based Adapters - The WCF-Custom adapter and SOAP actions

2/29/2012 4:04:47 PM
To illustrate the concept by a concrete example, let's refer to the source code provided with the Echo adapter. The point of our interest is the Execute method of the Microsoft.ServiceModel.Channels.Common.IOutboundHandler interface. This interface is one of the core interfaces that all ASDK-based adapters supporting outbound operations must implement. The Execute is called by the ASDK runtime to perform an outbound operation. Here is the implementation:

The code is self-explanatory and as you can clearly see, is action-centric. If the action coming with the SOAP header is recognized, the adapter performs the requested operation, if not, then the adapter responds with "Invalid Operation" exception. Since the Echo adapter exposes only one operation, using actions may seem unnecessary, but imagine the situation when an adapter exposes multiple operations? In such cases, using the SOAP actions is quite a logical way to help the adapter to decide what operation to perform.

There are two different ways to associate a BizTalk message with the appropriate SOAP action (or to attach the appropriate processing tag as you wish). One is to configure physical send ports using so called Action Mappings. The other is to set the actions dynamically at runtime.

Action Mappings

You will use the Action Mappings in the majority of cases—this is the easiest way to configure physical ports since the Consume Adapter Service Wizard does most of the job. For each operation that you selected at the design time, the Consume Adapter Service Wizard will generate a corresponding Operation entry inside the BtsActionMapping wrapper and place the mapping into the physical port binding file it will generate. In the general form, the action mapping looks as follows:

To process the actions mappings and attach the SOAP actions tags to incoming messages, the WCF-Custom adapter uses the following algorithm:

When the outbound message leaves an orchestration, the orchestration instance sets the BTS.Operation context property with the logical port operation name. Once the subscription mechanism pulls the message from the message box and hands it over to the physical port for processing, the WCF-Custom adapter tries to look up the actions map for the Operation with the Name matching the BTS.Operation property. If a match is found, then the adapter attaches the corresponding Action value to the message and sends it to the custom binding for execution. If a match was not found, then the WCF-Custom adapter treats the entire BtsActionMapping as one big action, so the custom binding will get the following action:<BtsActionMapping><Operation Name="Operation 1" Action =......</BtsActionMapping> with quite a predictable consequence—"Invalid action" exception. So, the rule is clear: for each orchestration outbound operation, there must be an Operation entry in the corresponding physical port action mappings with the Name attribute value matching the orchestration operation name.

It is important to note that for the content-based routing scenarios, where you don't use orchestrations and rely solely on the functionality provided by the messaging engine, you don't have to write a custom pipeline component to set the BTS.Operation context property. Luckily, the WCF-custom adapter supports an alternative single action format.

Essentially, this means that all messages arriving to the send port configured for the single action processing will be tagged with the same action regardless of the BTS.Operation context property. Since the Echo adapter supports only one operation, the single action approach is an alternative solution perfectly applicable to our sample application.

Setting SOAP actions dynamically

In the situations where you want to postpone the decision on what operation has to be performed until the runtime, you can use the WCF.Action context property. All you need to do is to add an Expression shape to your orchestration and configure the shape to execute the code similar to the presented below:

YourOutboundMessage(WCF.Action)="DesiredAction"

As you can see, the WCF-Custom adapter offers enough flexibility to address virtually any situation you may encounter. Once you understand the concept and available options, all it takes is accuracy and no longer than a couple of minutes to configure send ports.

Other -----------------
- Microsoft BizTalk 2010 : Consuming ASDK-based Adapters - Using the ASDK development tools
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Administration Tools (part 2)
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Administration Tools (part 1)
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - The Integrated Environment
- Managing Exchange Server 2010 Clients : Using Mail Profiles to Customize the Mail Environment
- Managing Exchange Server 2010 Clients : Managing the Exchange Server Configuration in Outlook
- System Center Configuration Manager 2007 : Configuration Manager and WMI (part 6) - WMI on Configuration Manager Servers
- System Center Configuration Manager 2007 : Configuration Manager and WMI (part 5) - The Configuration Manager Client WMI Namespace
- System Center Configuration Manager 2007 : Configuration Manager and WMI (part 4) - Hardware Inventory Through WMI
- System Center Configuration Manager 2007 : Configuration Manager and WMI (part 3) - Looking Inside the CIMV2 Namespace
- System Center Configuration Manager 2007 : Configuration Manager and WMI (part 2) - Managing WMI
- System Center Configuration Manager 2007 : Configuration Manager and WMI (part 1) - WMI Feature Set and Architecture
- System Center Configuration Manager 2007 : Active Directory Integration
- Deploying and Managing BizTalk Applications : Deploying a BizTalk Solution (part 2)
- Deploying and Managing BizTalk Applications : Deploying a BizTalk Solution (part 1) - Steps in Deploying a BizTalk Application
- Microsoft Dynamics CRM 4.0 Accelerators : Event Management Accelerator (part 3) - Publish the CRM Workflow & Testing the Portal
- Microsoft Dynamics CRM 4.0 Accelerators : Event Management Accelerator (part 2) - Install CRM Reports & CRM Customizations
- Microsoft Dynamics CRM 4.0 Accelerators : Event Management Accelerator (part 1) - Install CRM Customizations
- Microsoft Systems Management Server 2003 : Disaster Recovery - Using the SMS Site Repair Wizard
- Microsoft Systems Management Server 2003 : Disaster Recovery - Using the Recovery Expert
 
 
Most view of day
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 3) - Translating Text with the Mini Translator
- Windows Phone 7 : 3D Game Development (part 1) - 3D Game Concepts
- Conducting Research in OneNote 2010 : Translating Text
- Microsoft Access 2010 : Using Reports to Print Information - Opening and Viewing a Report
- Using Micrsosft Outlook 2010 with SharePoint and OCS : Using SharePoint Document Libraries in Outlook
- How to Troubleshoot Disk Problems (part 1) - How to Prepare for Disk Failures, How to Use Chkdsk
- Windows Server 2012 : Provisioning and managing shared storage (part 1) - Provisioning shared storage - Creating a storage pool
- Microsoft PowerPoint 2010 : Assigning Transitions to Slides
- SharePoint 2013 Request Management (part 2) - Request Management Administration
- Windows Server 2012 : Installing and Managing Hyper-V in Full or Server Core Mode - Installing Windows Server 2012 and Microsoft Hyper-V Server 2012
Top 10
- Microsoft Project 2010 : Linking Tasks (part 8) - Auditing Task Links,Using the Task Inspector
- Microsoft Project 2010 : Linking Tasks (part 7) - Creating Links by Using the Mouse,Working with Automatic Linking Options
- Microsoft Project 2010 : Linking Tasks (part 6) - Creating Links by Using the Entry Table
- Microsoft Project 2010 : Linking Tasks (part 5) - Creating Links by Using the Task Information Dialog Box
- Microsoft Project 2010 : Linking Tasks (part 4) - Entering Leads and Lags, Creating Links by Using the Menu or Toolbar
- Microsoft Project 2010 : Linking Tasks (part 3) - Using the Start-to-Start Relationship,Using the Finish-to-Finish Relationship
- Microsoft Project 2010 : Linking Tasks (part 2) - Using the Start-to-Start Relationship,Using the Finish-to-Finish Relationship
- Microsoft Project 2010 : Linking Tasks (part 1) - Defining Dependency Links
- Microsoft Project 2010 : Defining Task Logic - Manipulating Your Schedule
- Microsoft Lync Server 2013 : Director Troubleshooting (part 3) - Synthetic Transactions,Telnet
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro