Tenalinaga's Blog

I am frog in a well. Every time I jump out of the well; I relialize I am in bigger well and eventually get bored which motivates me to get to next level.

Ordered IPAD2

I got busy with my current project development. I finally ordered Ipad2 today. (It will take me a month to have it in my hands) I fell it gives me more opportunity to keep me connected to blogs and msdn forums. I will finish the pending posts and have couple more ideas about some topics I want to blog. Thank You.


BizTalk Scripting Samples for Build Automation

We keep adding as I work on them.. [:)].

Create Folder Locations using Power Shell Script

When dealing with a large project that has multiple receive location and send locations creating them is time consuming and error prone if you forget to create any. Scripting this task is simple and easy to replicate.

$TableNames =

$Path = “D:\Test\ProjectFileLocation\”
$PathBTpickup = “\BTInLocation”
$PathTestData = “\BTSampleData”
$PathBTOut = “\BTOutLocation”

foreach ($folder in $TableNames)
$Temp = $Path + $folder

if( Test-Path $Temp)
write-host $Temp “FolderExist”
New-Item $Temp -type directory
write-host $Temp “FolderCreated”


foreach ($folder in $TableNames)
$Temp = $Path + $folder + $PathBTpickup

if( Test-Path $Temp)
write-host $Temp “FolderExist”
New-Item $Temp -type directory
write-host $Temp “FolderCreated”

foreach ($folder in $TableNames)
$Temp = $Path + $folder + $PathBTOut

if( Test-Path $Temp)
write-host $Temp “FolderExist”
New-Item $Temp -type directory
write-host $Temp “FolderCreated”

foreach ($folder in $TableNames)
$Temp = $Path + $folder + $PathTestData

if( Test-Path $Temp)
write-host $Temp “FolderExist”
New-Item $Temp -type directory
write-host $Temp “FolderCreated”

Large Message Handling in BizTalk (Receive Side and Send Side Pipeline Components)

Create a Custom Itinerary Service for Calling BRE Rules (To get sensitive data from SSO for instance)

Custom Itinerary Class

I came accross a question at msdnWCF Custom Binding Credentials required BRE but have to be stored in SSO ? forums how to call Business Rules Engine (Microsoft offcourse!!) from Itineraries, which seemed straight.

It become intersting when questioner wanted to pass the object reference or database reference. Itineraries would let you use the Message (by setting useMsg, recoginze format to true) but not have option to pass parametrs.

Changing regsitry setting (including D-Word of StaticSupport = 1 or 2) and ESB extensions are the proposed solutions which might work. I tried the first and I am not sucessful.

So I came accross this Custom Itinerary feature some time back, and decided to use it. This class would help you solve similar problems or places where you need to write (C#) some code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.BizTalk.Message.Interop;
using Microsoft.BizTalk.Component.Interop;

namespace CustomItineraryServicePipelineComponent
class CustomPipelineItineraryService:Microsoft.Practices.ESB.Itinerary.IMessagingService

public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext context, Microsoft.BizTalk.Message.Interop.IBaseMessage msg, string resolverString, Microsoft.Practices.ESB.Itinerary.IItineraryStep step)

System.Diagnostics.Debug.WriteLine(“\nInside Execute Method\n”);

if (context == null)
throw new ArgumentNullException(“context”);
if (msg == null)
throw new ArgumentNullException(“msg”);
if (string.IsNullOrEmpty(resolverString))
throw new ArgumentException(“Properties.Resources.ArgumentStringRequired”, “resolverString”);

System.Diagnostics.Debug.WriteLine(“Parametrs Received Corretly”);

// Try Starts here
Microsoft.Practices.ESB.Resolver.ResolverInfo _info = Microsoft.Practices.ESB.Resolver.ResolverMgr.GetResolverInfo(Microsoft.Practices.ESB.Resolver.ResolutionType.Endpoint, resolverString);
if (!_info.Success)
throw new ArgumentException(“Properties.Resources.Failed to aquire ResolverInfo”, “resolverString”);

// System.Diagnostics.Debug.WriteLine(“Got Resolver into and about to get Resolver Dicitinary”);

//Microsoft.Practices.ESB.Resolver.ResolverDictionary _Dictionary = new Microsoft.Practices.ESB.Resolver.ResolverDictionary _Dictionary();
Dictionary _Dictionary = Microsoft.Practices.ESB.Resolver.ResolverMgr.Resolve(_info, msg, context);

// System.Diagnostics.Debug.WriteLine(_Dictionary.Count().ToString());

// List _list = new List (_Dictionary.Keys);

// foreach (string _k in _list)
// {
// System.Diagnostics.Debug.WriteLine(_k, _Dictionary[_k]);
// }

Microsoft.Practices.ESB.Adapter.AdapterMgr.SetEndpoint(_Dictionary, msg.Context);
System.Diagnostics.Debug.WriteLine(“Endpoints Set”);

string _TransportLocation = “”;
string _UserName = “”;
string _Password = “”;

System.Diagnostics.Debug.WriteLine(“Get SSO Information”);

_TransportLocation = Microsoft.SSO.Utility.SSOConfigHelper.Read(“Naga”, “OracleTransportLocation”);
_UserName = Microsoft.SSO.Utility.SSOConfigHelper.Read(“Naga”, “OracleWCFUserName”);
_Password = Microsoft.SSO.Utility.SSOConfigHelper.Read(“Naga”, “OracleWCFPassword”);

System.Diagnostics.Debug.WriteLine(“itinerary TransportLocation” + _TransportLocation);
System.Diagnostics.Debug.WriteLine(“itinerary UserName” + _UserName);
System.Diagnostics.Debug.WriteLine(“itinerary Password” + _Password);
System.Diagnostics.Debug.WriteLine(“Error fetching SSO information”);
throw new System.ApplicationException(“Error”);

System.Diagnostics.Debug.WriteLine(“Promote Properties”);
msg.Context.Promote(“OutboundTransportLocation”, “http://schemas.microsoft.com/BizTalk/2003/system-properties”, _TransportLocation);
msg.Context.Promote(“UserName”, “http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties”, _UserName);
msg.Context.Promote(“Password”, “http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties”, _Password);
return msg;

public string Name
get { return “CustomPipelineItineraryService”; }

public bool ShouldAdvanceStep(Microsoft.Practices.ESB.Itinerary.IItineraryStep step, IBaseMessage msg)
return true;

public bool SupportsDisassemble
get { return true; }

Resolver I used is BRE for getting endpoints. Which would look like.

Import things to notice are Transport Location, UserName & Password (these are part of set “Set End Point Config to” in BRE) are set to “GetFromSSO” which is a string, that gets overwritten by content obtained from SSO in the class.


Check the link to development of Custom Itinerary Messaging Service for better documentation.

Set End Point Config to BindingType=oracleDBBinding&BindingConfiguration=&EndpointBehaviorConfiguration=

Multi-record Insertion into Oracle DB using ESB Messaging Scenario

Multi-Record Insertation into any table within Oracle DB using ESB Messaging Scenario based on Message Type

Idea of this sample seems to pretty be intersting when I first thought about it. we are originally thinking more in lines of having seprate WCF service to inert into each table and Main Orchestration having to call sepecific WCF service dynamically. These services need individual orchestration to published as WCF service.

But here Idea is to develop one single service which can be consumed by generic orchestration which accepts XMLDocument type. Input XMLDocuments would be one among set of defiend schemas that hold data that should be inserted to corresponding tables. We achive this WCF service with out orchestration (just messaging senario) using Itineraries.

Step1: Creation of 2 test Oracle Tables

For Demonstration I created 2 tables in HR database.  I want to insert into any of the 2 tables based on the incoming schema.

Oracle Test Tables


 Step2: Creation of Schemas and Maps

using Consume Adapter Service -> OracleDBBinding I have generated  Request schemas for table insert operation. Generated schema structure for “TABTESTPRODCUTS” and “TABTESTSTORES” table is shown side by side.

Oracle Insert Schemas

I want service response to be in "standard normalized manner". Standard response schema to notify sucess/failure is below

Normalized Response

So I developed schema and maps for Oracle Insert response form oracleDB to normalized schema. 2 map are below.

Oracle Insert Schemas

I also created 2 schemas (Original Data Schemas) which has data that should be inserted into oracleDB. (In a genralized sense these can be defined set of defined schemas that hold data for corresponding tables in OracleDB)

Native Data Schemas

Then I created maps to map Original Data Schemas to oracle request schemas.

Maps To Request Schema

Step3: Creation of WCF Service Receive Port and Dynamic soilict-response Port

We proceed to cretate a WCF service using WCF schema publishing Wizard and create a receive location. Input Schema is of type “Microsoft.XLANGs.BaseTypes.Any” and Output response schema is standard normalized response. Configure Receive Location is shown below

WCF Service Receive Port

ItinerarySelectReceiveXML has itinerary selector component that can select the itinerary. we use Resolver.Itinerary" to fetch itinerary from Database. Itinerary we are about to develop in next steps is named "GenricOracleInsert". We also create a Dynamic Solicit Response port and provide configuation as shown below

Dynamic Solicit Respone Port

Step4: Creating BRE Polcies

We will need to create 3 BRE policies.

1) First one to Select the Map based on the incoming message type for the input schema.

 BRE Request Map

2) Second Policy To Set the OutBound Transport End Points

BRE Request Map

3) Thrid Policy to set the Map to normalize response to Standard Reponse.

 BRE Request Map

Step5: Itinerary Design

Now we have all the required artifact. we need deploy them in BT application. Then we can proceed with Itinerary Design

Itinerary is like routing slip and steps associated are shown below.

based on messagetypes BRE policy provide information to perform dynamic routing and transofrmations.


 Itinerary Design

Step6: Generic InBound Test Orchestration

Generic Inbound Test Orchestration

We now create a test orchestration to test the WCF service we create. This genric orchestration accepts valid XMLDocuments as input.

Typically incoming XMLDocuments are validated by the receive XMLdisassembler pipeline component and subscribed by the orchestration.

Then we route defined Orginal Data schemas to the WCF service (remember WCF service input schema is also generic which accepts any valid XMLDocuments).

Then baed on BRE policies it gets transformed, and Outbound transport context properties are set and subscribed by dynamic solicit response port.
On the response from solicit-response port we choose a map based on policy in BRE to get normalized response.

Generic Test Orchestration for the WCF service would look like.

Itinerary Design

BizTalk WCF-Oracle Adapter

Oracle 11g

OUTBOUND Operations

1) Using Stored Procedure with SYS_REFCURSOR

Here we try to select multiple rows from Oracle Database using WCF-OracleDB adapter from BizTalk.
For the example I have used “EMPLOYEES” and “JOB_HISTORY” tables in “HR” department. I created a package and two stored procedure within the package.
First one selects Employees based on DepartmentID (while other gets employee start and end date based on employee_id).
For this example I used first stored procedure.

Creating Package

Package Creation

Create Package Body

Package Body

Now that we have stored procedure we need to generate request and
response schemas using BizTalk Adapter Service.
Then we can configure by providing credentials and hostname and service name (this information is avilable in tnsnames.ora file).

once you succeed in connecting to database you can browse to your package then select stored procedures


This will generate the schema

Generated Schema

we develop the orchestration send the request (transform shape maps the input ID to ID in Request ) and get the response


Now we build the application and deploy it into BizTalk administrative console. We configure the adapter.
We provide the credentials and there are couple of GOTCH here. “OperationName” must be equal to logical request response operation name within orchestration.
In the Configuration Bindings tab Set “Ambient transcation to false.


Resultant Output Would look like


2) Using Stored Procedure with REF CURSOR

You can obtain a different result by slight modification of the stored procedure and following the same procedure

stroed procedure will select the records with status ‘NEW’ and update their status to ‘OLD’ once they are written into cursor.

Genrated schema would be little different. It will have same request element and response would look like


3) Using Basic SQL Select

Here we again use AddGenerateItems -> Consume Adapter Service -> OracleDB Binding and provide the credentials and HostName and Service name as above.
Once we establish connectivity we select the requried table and the operation. This would generate a schema which looks like 

Consume Adapter Service

Here we need a map to fill the column names (required column namesin table) and filter expersion


Orchestration to send req and obtain response would be very much similar to the above method and deployment and send port(req-resp) would be similar.Beaware of above mentioned GOTCH’s.

Obtained result would look like


INBOUND Operations
4) Polling and Notification Services

For Pooling service during the configuring database setting -> Binding properties -> Polling Receive -> Enter following
1) Polling data Avilable (if this data is avilable then it pools)
2) Polling Statement
3) Post Poll Statement (executes after polling statement gets executed)
4) enter the credentials
5) Click ok and test the connectivity.
6) Select “InBound” Operations and select “\” on top then Polling this will generate the required polling input schemas.

For Notification service during the configuring database setting -> Binding properties -> Enter following
1) Enter the notification statements
2) Set notifyonlistenerstart to true
3) enter the credentials
4) Click ok and test the connectivity.
5) Select “InBound” Operations and select “\” on top then Notification this will generate the required Notifcation input schemas.

Gotcha: you must change the notification for this to work
In Oracle : grant change notification to

All the above procedure is used of SELECT Now short notes for INSERT

You can write a stored procedure for insert and generate schemas. But Insert schemas generated has one record Request and response.

using BASIC CRUD operations of WCF-Oracle adapter on the tables it is possible to insert multiple rows into oracle. You should use “Insert” Node which imports array of inserts.
operation name of logical port should be Insert.

I shall try to find if there is a way to insert multiple records into oracle table using stored procedure.

Tracking Messages with BizTalk BAM API

Will post sample in couple of days.

Useful Link of bm.exe commands

ESB Static and Dynamic Resoultion and Itineraries

Itineraries” when I first heard this term it made no sense to my BizTalk brain. With in Short time I had to come Face to Face with ESB (Enterprise Service Bus) for one of my clients who want to implement SOA (Service Oriented Architecture) and also Error Handling using ESB Portal. There is lot of learning curve and it looked scary. I tried to propose alternatives to solve the problem due to short development time before us but pros clearly outweighed cons. That is when, I determined to make some progress with ESB and started to take a look at it and learn features of ESB.

This post explains the Messaging scenarios using
A) Dynamic Resolution for one way WCF service call
B) With Itineraries (UDDI Resolver) Dynamic Resolution for one way WCF service call
C) With Itineraries (BRE and Static Resolver) Dynamic Resolution for Two way WCF service call and Subsequent forwarding

Part 1: Creating WCF Services
Before entering into doing ESB features we first need to have some services up to route message to them. So I developed Orchestration A and Orchestration B.
Orch A has One Way receive Port has shown in fig below. Output is published to message box and there is a send port in the application that subscribes to this message type from Message box then routes it to output destination folder.


Orch B has Request response Port has show in fig below. This orchestration receives message and send response back.


I published two orchestrations as WCF services (OrchA is a one way receive port and OrchB is Two-way req-resp receive port) and allowed WCF service to create Receive ports in my BizTalk application named SNR.Mamata.CommonArtifacts. Associated orchestration bindings to these receive ports.
So Here we have created 2 WCF Services one is one way other is req-resp. So we will use these services to develop Messaging scenarios using ESB core features.

Part-2 : ESB Implementation

A) Dynamic Resolution for one way WCF service call
I have created a new BizTalk Application SNR.Mamata.DynamicResoultion. Here I am trying to implement a messaging scenario to call one way WCF service. I want to pick up a .xml file from Receive Location in File System.

Custom Pipeline has just one ESB pipeline component “ESBDispatcher”. This component figures out the end point configuration using BRE, Static, UDDI …

Here I used BRE to configure endpoint information by calling a policy.

BRE policy is shown below. condition 1 equals 1 always evaluates to true so end point transport type, target namespace, WCF action, outbound transport location is set. you could also have BRE by evaluating any context properties.

Now I created a create a Dynamic send port that subscribes to this message by receive port name (BTS.ReceivePortName). For now do not worry about other Filter expressions(Not related to this scenarioA). Those are used later and will be explained in the below part.

What did we Just do:
When message is received from Receive port Custom Pipeline with ESB dispatcher calls BRE and gets the outbound end point configuration details. The send port subscribes to these messages and send this message to the transport location using protocol specified.
This need not always be BRE, it can be UDDI or Even Static
Static resolver looks like

B) With Itineraries (UDDI Resolver) Dynamic Resolution for one way WCF service call
Here we will do the same with help of Itinerary. In the Dynamic send port add the remaining filter expressions (Hold on I Shall explain what they are below)
We also create a new receive port and location to pick up .xml message from File location. We now use ESB Itinerary selector pipeline component which is available in “Itineraryselectreceivexml pipeline” or your own custom pipeline.

Itinerary Key fact Resolver.Itinerary indicates thats Itinerary is avilable from SQL server Database with name UDDIItinerary.

To develop UDDIItinerary first create a C# class library then create a new itinerary. Drag on Ramp and off ramps. and two Itinerary services. There should be off-ramp extender before OffRamp.

OnRamp: select the Extender and BizTalk application and Receive Port Name.

ItineraryService1: select the container and Itinerary service name (Routing/Transformation) Routing in our case.
Resolver: Add new Resolver and select UDDI resolver component.
Within the First Itinerary service we have add new resolver and select UDDI in resolver implementation. It be any one of the available. Binding key can be used to resolve the end point information.

Off Ramp: Select the dynamic send port that promotes your filter expression values to the message context properties so your dynamic send port can subscribe the message.

c) With Itineraries (BRE and Static Resolver) Dynamic Resolution for Two way WCF service call and Subsequent forwarding
In this example we extend the same above Itinerary. We create pick up the .xml from the file location and call the request-response web service then route the message to other dynamic send port that drop the message to the file location.

I have used BRE for path resolution. Choosing BRE resolver implementation would let you select the BRE policy and version.

Below is the ploicy created using BRE.

We also used static resolver to route the response from WCF service to the file location.

We need to create two dynamic ports. one is Req-Resp port to make a call to 2-way WCF Service. It uses ItinerarysendPassThrough Pipeline which has ESB Itinerary Cache and preserves the state of the itinerary. Upon the response from WCF service Itinerary again starts getting executed from that point.
with filter expersions as below
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == DynamicReqResp And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging And
Microsoft.Practices.ESB.Itinerary.Schemas.IsRequestResponse == True

Upon receiving response ItineraryFrowarderSendReceive Pipeline Component evaluates static resolver and contiunethe itinerary. It has filter expersion as below
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == DynamicCacheSendService And Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging And
Microsoft.Practices.ESB.Itinerary.Schemas.IsRequestResponse == False

ESB Dynamic Gudiance inside orchestration is avilable in the lnk



BizTalk 2010 ESB 2.1 Installation

1) Install InfoPath 2003/2007 used to render exceptions details.
2) Install enterprise library 4.1 used by ESB Management portal
3) Make sure default web site is running in ASP.NET 2.0
4) Install Dundas Chart for ASP.NET Enterprise (*)
5) Install BizTalk ESB Toolkit 2.1-x64
6) Install Itinerary Designer from ALL Programs -> ESB Itinerary Designer.
7) Configure ESB Configure Tool (Have to configure step after step)
Above step creates the Databases and web services ..
In BizTalk Administrative console create an application with Microsoft.BizTalk.ESB and import the MSI file that suites your Platform and also install it.
9) Run the UDDI Publisher Tool available at %ESB Install Folder%\Bin\Microsoft.Practices.ESB.UDDIPublisher.exe this will add the t-models and services.
(Make sure that Microsoft UDDI Services does not require Secure Sockets Layer (SSL) for publication to the UDDI Services site)
10) Depoly BAM Tracking
>>Bm.exe deploy-all -DefinitionFile:”C:\Program Files\Microsoft BizTalk ESB Toolkit 2.1\Bam\Microsoft.BizTalk.ESB.BAM.Itinerary.xml”
>>Bm.exe deploy-all -DefinitionFile:”C:\Program Files\Microsoft BizTalk ESB Toolkit 2.1\Bam\Microsoft.BizTalk.ESB.BAM.Exceptions.xml”
11) Add switch to system.diagnostics to enable Biztalk ESB tool kit trace switch.
12) Create a c -> Project -> Microsoft.Practices.ESB folder and unzip the ESB source into 1st folder
13) Remove Read only from the properties of the folder.
14) Run the following command in the powershell to have unrestricted access
set-executionpolicy unrestricted (Host Machine)
Set-ExecutionPolicy -scope process Unrestricted (VM Machine gives ability to execute scripts for current process)
15) Check to see if the services are up and running in IIS.
16) Created a Microsoft.Practices.ESB.Key in the C:\projects\Microsoft.Practices.ESB\ESBSource\Keys floder
17) Changed one line to reflect correct path in Management_Install.ps1 $env:VS=”${env:ProgramFiles} (x86) \Microsoft Visual Studio 10.0\Common7\IDE”
18) Install the Mangment_Install.ps1 script (This will create the ESB.Portal Web Application)
19) Set connection strings database in web.config file and check if the .asmx and .svc services are up in running
20) This is third time I having problem with GetApplications() in PortalHelper.cs class with BizTalk Operations Service. I modified the code to below.
21) Restart IIS , I have my portal up in running (with Biztalk Operations service not working)
Error 1:
Management_Install.ps1 cannot be loaded because the execution of the scripts is disabled on this system. Please see the “get-help about_signing” for more details
At line:1 char:25
‘ .\Management_Install.ps1 << run this before installing portal (Management_Install.cmd) Make sure WCF scriptmaps are registered by executing the command
C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg.exe -r -y
=> aspnet_regiis –irv registers the version of .NET to be used for IIS.



Missing Pipeline Components

ESB Installation in Better organsized manner

BizTalk 2010 Intergration with Oracle E-Business Suite

I started Working on Oracle E-Business Suite. Will Have more stuff coming up Eventually.