Automatically create a response to BizTalk WCF Service Publishing Wizard using Context Based Routing

Recently I found myself taking a deep dive into BizTalk. The main reason was to fix a little architectural challenge I faced when using the out of the box WCF-BasicHttp adapter. This adapter provide you with the capability receiving WCF requests and porting them to the BizTalk MessageBox. All good so far, I used the out of the box “BizTalk WCF Service Publishing Wizard”.

The problem

Create a WCF-BasicHttp service that accept messages and delivers them to the BizTalk MessageBox. Send back a “receive acknowledgement” to the requesting client (using Context Based Routing, without the use of Orchestations).

The solution

Step 1 – Create new Empty BizTalk Server Project
clip_image002
Name: Custom Pipeline
Solution Name: XMLReceiveCBR

Add new “Receive Pipeline” item.
clip_image004

Add “XML disassemble” Pipeline Component to the pipeline
clip_image006

Create a new “custom pipeline component”.
To do this first add a new “Class Library”.
clip_image008

Remove Class1.cs
clip_image010

Create new class PromotePropertiesCBR.cs
clip_image012

Add references
clip_image014
Add the following references this way:
– BizTalk Pipepine Interop
– System.Drawing

Add using statements:
clip_image016

Make class public and implement the following interfaces:
clip_image018

Let Visual Studio create the code snippets for the interfaces automatically:
clip_image020

This will create the following members:
clip_image022

Next we will code the interface implementations.
“IBaseComponent” Implementation:
clip_image024

“IComponent” implementation:
clip_image026

“IComponentUI” Implementation:
ATTENTION: Don’t forget to declare your static “ResourceManager”
clip_image028

Create a new Resource File
clip_image030

Select “images” in your resource file.
clip_image032

Add your image
clip_image034

Remove the designer file
clip_image036

Add the following “Component Category Attributes” to the code:
clip_image038

Build your project and copy your custom “Custom Pipeline Components.dll” to the biztalk Pipeline Components directory.
“C:Program Files (x86)Microsoft BizTalk Server 2009Pipeline Components”
clip_image040

Open XMLReceiveCBR.btp

Add the newly created Custom Pipeline Component to the Toolbox
clip_image042

Select “PromotePropertiesCBR Component”
clip_image044

Add the new component to the pipeline
clip_image046

Sign the assembly’s
clip_image048

clip_image050

Set BizTalk Application Name
clip_image052

Deploy your solution!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s