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.

Category Archives: BizTalk

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 =
“TestSubProject1″,”TestSubProject2”

$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”
}
else
{
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”
}
else
{
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”
}
else
{
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”
}
else
{
New-Item $Temp -type directory
write-host $Temp “FolderCreated”
}
}

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

BizTalk Lnks from Other blogs

WCF Services Failure with Exception message: The authentication scheme ‘“Negotiate’ is not supported.

Exception information:
Exception type: NotSupportedException
Exception message: The authentication scheme ‘“Negotiate’ is not supported.

Solution:
Open a prompt and type:

# cd c:\inetpub\AdminScripts
# cscript adsutil.vbs get w3svc/NTAuthenticationProviders

If you find you have something like “Negotiate,NTML” then type:
# cscript adsutil.vbs set w3svc/NTAuthenticationProviders
“Negotiate,NTLM”
or delete the key, since IIS6 has this value by default
# cscript adsutil.vbs delete w3svc/NTAuthenticationProviders

By the way, you should probably check it also on the specific WebSite
where the service is setup, example:
# cscript adsutil.vbs get w3svc/1/ROOT/NTAuthenticationProviders

Some Notes for BizTalk 2010 Installation

Environment: Windows Server 2008 R2, Visual Studio 2010, SQL Server 2008 R2, BizTalk 2010

Installation of BizTalk 2010, Configuration, BAM

1) Install the Server 2008 R2 (64 bit) and perform windows Updates.
2) Install MS office 2007/2010
3) Install IIS, SMTP, FTP, .NET 3.5, MSMQ
4) Install Visual Studio 2010 (x86) ->Use Custom settings->exclude SQL 2008 Express Services, F#
5) Check for service updates and windows updates
6) Install SQL Server 2008 R2 (Firewall need to Open Ports)
7) Install SQL Server 2005 Notification Services
8) Service pack 3 for SQL Server 2005
9) Install Microsoft SharePoint Foundation Server 2010 (Beware of little Issue check my blog, exist the wizard and follow the link and then start SharePoint 2010 Products configuration wizard )
10) Configure SharePoint portal.
11) Install BizTalk 2010
12) Configure BizTalk 2010
13) Enable TCP/IP and Named Pipelines and DTDC on local host server
14) Created 2 web sites one with .net4.0 other with .net2.0 (classical ASP)
15) BAM Portal runs on BAM Application pool on .NET 4.0 classic
16) Install BizTalk Adapter Pack 2.1 64 bit
17) Install UDDI and for Configuration beware of SSL settings (UDDI Management Console -> UDDI Properties -> Security -> un-check require SSL and use Windows Integrated publisher authentication.
18) Install and Configure BizTalk RFID.

Errors and Resoultions:

1) one of the missing information in the Installation document is you need set the IIS to only native 64-bit mode.
Script to confgure IIS to 64-bit operation
cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 0
Script to confgure IIS to 32-bit operation
cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1

2) Secondly while Configuring Share Point Foundation Server 2010. Ran into error that reads:Local Accounts Should not be used in Stand Alone Mode
run the command in sharepoint Management Shell : “New-SPConfigurationDatabase”
It is detailed in this link below.
This command will create 2 database and SharePoint web Services site in IIS websites.

3) Thridly Notification Services which are not in SQL 2008 R2 needs to installed.
Installing SQL Notification Services for BAM I used SQL 2005 Developers iso image and installed features then updated with SQL 2005 SP 3. I sucessed.

I failed when i followed SQL notification installation as stated in manual “BizTalk 2010 Installation and Configuration Guide – Development and Test Build BizTalk 2010 64-bit, SQL Server 2008 R2 64-bit, Windows 2008 R2 64-bit” I also tried hotfixes but it got complicated and i messed it up.

I just used MS installation guide installed all the prerequests and it worked great. Above Manual is also really helpful it provides screen shoots for step by installation.

4) Failed to deploy BAM activity definitions. Please make sure that all BAM related Data Transformation Services (DTS) packages are removed along with the BAM databases.

This link has dealt this well.

5) BAM Portal Application Pool is .NET 4.0 Classic

6) UDDI Publish Subscribe pages not found

I had to resolve the UDDI ssl settings.

Custom Pipeline Component To PreProcess XML (can be modified to add just AddNameSpace)

After Debatching there will times in which extracted nodes will not have name namespace. This will create problems in transformation shapes and message types not being matched. So this example shows custom component to preprocess xml nodes by adding namespace before it is split. Then you can use xml disassembler or ESBdispatcher disassembler components to split the envelope which will provide xsd schemas with namespaces.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Resources;
using System.Reflection;
//BizTalk Classes
using Microsoft.BizTalk.Message.Interop;
using Microsoft.BizTalk.Component.Interop;

namespace XXX.AddNameSpaceUpdateBatch
{
[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
[ComponentCategory(CategoryTypes.CATID_Any)]
[System.Runtime.InteropServices.Guid(“9d182f63-7663-4c42-b9e0-31088e92d369”)]
public class CustomAddNameSpaceUpdateBatch : Microsoft.BizTalk.Component.Interop.IPersistPropertyBag, Microsoft.BizTalk.Component.Interop.IBaseComponent, Microsoft.BizTalk.Component.Interop.IComponent, Microsoft.BizTalk.Component.Interop.IComponentUI
{

private string _NewNameSpace;
public string NewNameSpace
{
get { return _NewNameSpace; }
set { _NewNameSpace = value; }
}

#region IBaseComponent Members

public string Description
{
get
{
return (“Add NameSpace to XML”);
}
}

public string Name
{
get { return (“XmlUpdateRecordsStatusAddNameSpace”); }
}

public string Version
{
get { return (“1.0.0.0”); }
}

#endregion

#region IComponentUI Members

public IntPtr Icon
{
get { return new System.IntPtr(); }
}

public IEnumerator Validate(object projectSystem)
{
return null;
}

#endregion

#region IComponent Members
public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
{
IBaseMessagePart bodyPart = pInMsg.BodyPart;
//StringBuilder outputMessageText = null;
string messageType = “”;
if (bodyPart != null)
{
Stream originalStream = bodyPart.GetOriginalDataStream();
if (originalStream != null)
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(originalStream);

StringWriter sw = new StringWriter();
XmlTextWriter tx = new XmlTextWriter(sw);
xdoc.WriteTo(tx);
string _strXdoc = sw.ToString();
System.Diagnostics.EventLog.WriteEntry(“”, _strXdoc);
_strXdoc = _strXdoc.Replace(“

“, “”);
_strXdoc = _strXdoc.Replace(“
“, “”);
System.Diagnostics.EventLog.WriteEntry(“”, _strXdoc);

byte[] outBytes = System.Text.Encoding.ASCII.GetBytes(_strXdoc);
MemoryStream memStream = new MemoryStream();
memStream.Write(outBytes, 0, outBytes.Length);
memStream.Position = 0;

bodyPart.Data = memStream;
pContext.ResourceTracker.AddResource(memStream);

}
}
messageType = “http://NameSpace#RootNode”;
string systemPropertiesNamespace = @”http://schemas.microsoft.com/BizTalk/2003/system-properties”;
pInMsg.Context.Promote(“MessageType”, systemPropertiesNamespace, messageType);

return pInMsg;
}

#endregion

#region IPersistPropertyBag Members

public void GetClassID(out Guid classID)
{
classID = new Guid(“b94e8347-9516-4cbb-8c8b-dcf0789008c2”);
}

public void InitNew()
{

}

public void Load(IPropertyBag propertyBag, int errorLog)
{
object val = null;

try
{
propertyBag.Read(“NewNameSpace”, out val, 0);
}
catch (Exception ex)
{
throw new ApplicationException(“Error reading propertybag: ” + ex.Message);
}
if (val != null)
_NewNameSpace = (string)val;
else
_NewNameSpace = “http://AnonymusURL”;

}

public void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
{
object val = (object)_NewNameSpace;
propertyBag.Write(“NewNameSpace”, ref val);

}

#endregion
}
}

Looping in BizTalk Orchestration.

When we have message with recuring nodes inside orchestartion there are several ways to Debatch the message.

1) Envelope schema being my favourte

2) Looping using Xpath with in orchestration is also clean way. Good Sample in the link

3) We could also write a custom component that does debatching which is little involved.

We shall see how we deal with these three cases in this topic.

Hello Folks!

I realize what I know and understand is so small compared to what exists. I am passonate about technology and learning.

Microsoft BizTalk is primarly focus of my blog for now. Here I wish to document some Errors that trouble me and Examples I find intersting.

This is perfertly useless introduction, but that is yet for now.