Navigation

Search

Categories

 
 

On this page

Biztalk AddIn for Reflector
New version of BizTalkGenerateStrongName tool
Get the connection string to BizTalkMgmtDb
BizTalk Server 2006 project properties
Custom GetContextProperty Functoid
the exists operator
BTSEasyReflector 1.1 release
MSBTS_*, new features in BizTalk Server 2006
Unsupported Microsoft.BizTalk.Deployment.dll

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 21
This Year: 0
This Month: 0
This Week: 0
Comments: 29

Sign In
Pick a theme:

 Saturday, June 10, 2006
Saturday, June 10, 2006 8:03:17 PM (GMT Standard Time, UTC+00:00) ( biztalk )

Gilles has developer an addin for Reflector that allows you to list all BizTalk artifacts contained in an assembly and extract them.

Read more in BizTalk AddIn for Reflector

 Monday, April 24, 2006
Monday, April 24, 2006 3:24:39 AM (GMT Standard Time, UTC+00:00) ( )

I have made some modifications to the BizTalkGenerateStrongName tool developed by Jon Flanders, for more info about this tool please visit his post "Another BizTalk development tool".

The principal change is set the new property value to all BizTalk projects in your solution, additionally include:

.- Copy the existent values of one BizTalk project to all BizTalk projects in the same solution

.- Override the property values in all BizTalk projects

.- Besides to edit the Assembly Key property, you could set a new value to Application Name property in BizTalk projects

You can download the project from BiztalkGenerateStrongName: Workspace site.  This tool works with VS 2005 and BTS 2006.

Thanks to Jon Flander to let me publish these modifications. 

 Tuesday, April 04, 2006
Tuesday, April 04, 2006 3:24:03 AM (GMT Standard Time, UTC+00:00) ( )

When Microsoft.BizTalk.ExplorerOM namespace is used to set/get the artifacts of BTS, the first property that you need to set is BtsCatalogExplorer.ConnectionStringBtsCatalogExplorer uses this property to connect to bts configuration database (BizTalkMgmtDb).

Many people save this connection string in a configuration file (.config) or directly in the code.  For example:

BtsCatalogExplorer catalog = new BtsCatalogExplorer();
catalog.ConnectionString = System.Configuration.Settings.AppSettings["BtsCofigDatabase"];
- or -
catalog.ConnectionString = "server=SQLServer;database=BizTalkMgmtDb;integrated security=true";

This code is not reusable or may be it'll need administration to set the value in the config file when the solution is installed in another bts server.

You can get the connection string dynamically using WMI or Windows Registry to delete this issue.  I developed a little helper class (see code below) with one static method that return the connection string of the configuration database (BizTalkMgmtDb).  Now, you don't need use any config file and your code'll be reusable.  For example:

BtsCatalogExplorer catalog = new BtsCatalogExplorer();
catalog.ConnectionString = BtsHelper.BtsConfigurationDatabase.GetConnectionString();

Code: BtsHelper Class

using System;
using System.Data.SqlClient;
using System.Management;
using Microsoft.Win32;

namespace BtsHelper
{
public class BtsConfigurationDatabase
{
private string _database;
private string _server;
private static BtsConfigurationDatabase _btsConfig = null;

private BtsConfigurationDatabase()
{
this._server = string.Empty;
this._database = string.Empty;
}

private bool GetUsingWMI()
{
bool regFounded = false;
this._server = string.Empty;
this._database = string.Empty;
try
{
using (ManagementObjectSearcher searcherGroupSetting = new ManagementObjectSearcher())
{
searcherGroupSetting.Scope = new ManagementScope(@"root\MicrosoftBizTalkServer");
searcherGroupSetting.Query = new SelectQuery("select * from MSBTS_GroupSetting");
using (ManagementObjectCollection.ManagementObjectEnumerator enumGroupSetting = searcherGroupSetting.Get().GetEnumerator())
{
while (enumGroupSetting.MoveNext())
{
ManagementObject groupSetting = (ManagementObject)enumGroupSetting.Current;
this._server = groupSetting["MgmtDbServerName"] as string;
this._database = groupSetting["MgmtDbName"] as string;
regFounded = true;
break;
}
return regFounded;
}
}
}
catch (Exception) { }
return regFounded;
}

private bool GetUsingRegistry()
{
bool regFounded = false;
this._server = string.Empty;
this._database = string.Empty;
using (RegistryKey keyBts = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\BizTalk Server\3.0\Administration"))
{
if (keyBts == null)
return regFounded;

this._server = keyBts.GetValue("MgmtDBServer") as string;
if (this._server == null)
this._server = string.Empty;

this._database = keyBts.GetValue("MgmtDBName") as string;
if (this._database == null)
this._database = string.Empty;

regFounded = true;
}
return regFounded;
}

public static string GetConnectionString()
{
if (_btsConfig == null)
_btsConfig = new BtsConfigurationDatabase();

if (!_btsConfig.GetUsingWMI())
_btsConfig.GetUsingRegistry();

if ((_btsConfig._server == string.Empty) || (_btsConfig._database == string.Empty))
throw new ApplicationException("Error when get the connection string!");

SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
sb.DataSource = _btsConfig._server;
sb.InitialCatalog = _btsConfig._database;
sb.IntegratedSecurity = true;
return sb.ToString();
}

}
}
 

** Don't forget reference the System.Management.dll assembly to build the class.

Tuesday, April 04, 2006 3:20:52 AM (GMT Standard Time, UTC+00:00) ( )

Using the EnvDTE.Project class you can access the BizTalk Server 2006 project properties to get/set its value.  A bts-project uses two collections to store the properties; I’ll explain where you can find each property.

Configuration Properties

To access the configuration properties, you need to get the item ConfigProperties from the active configuration.  This item gets a value that represents the dictionary that contains the properties. (See code below)

 

Property configProperties = project.ConfigurationManager.ActiveConfiguration.Properties.Item("ConfigProperties");
IDictionary dicConfigProps = configProperties.Value as IDictionary;
string outputPath = dicConfigProps[DictionaryTags.OutputPath].ToString();

In the code, the type of project variable is EnvDTE.Project and represents the BizTalk Server 2006 project.  This object has a dictionary with each property related to configuration, to access each property you must use the DictionaryTags.

In the example, I get the location of the output files for the current project using the DictionaryTags.OutputPath key.  This is the list that you can access in this dictionary.

 

Configuration Properties

Enumeration

Section: Build

Restart Host Instances: specifies whether to restart all BizTalk in-process host instances on local machine.

DictionaryTags.RestartHostInstances

Register: specifies whether to register the assembly in the Global Assembly Cache.

DictionaryTags.Register

Redeploy: specifies whether to delete existing configuration and recreate it every time the assembly is deployed.

DictionaryTags.Redeploy

Application Name: specifies the BizTalk Application in which to deploy the assembly.

DictionaryTags.ApplicationName

Configuration Database: configuration Database to deploy.

DictionaryTags.ConfigurationDatabase

Server: specifies the server when the BizTalk Configuration Database resides.

DictionaryTags.Server

Section: Deployment

BPEL Compliance: specifies whether to generate Business Process Execution Language (BPEL) compliance output.

DictionaryTags.BpelCompliance

Generate Debugging Information: specifies whether generate debug symbols.

DictionaryTags.GenerateDebuggingInformation

Embed Tracking Information: specifies whether to embed tracking information in the assembly.

DictionaryTags.EmbedTrackingInformation

Treat Warnings As Errors: specifies whether to treat warning as errors during the build.

DictionaryTags.TreatWarningsAsErrors

Warning Level: specifies the warning level.

DictionaryTags.WarningLevel

Output Path: specifies the location of the output files for this project configuration.

DictionaryTags.OutputPath

 

Common Properties

To access the configuration properties, you need to get the item CommonProperties from the project.  This item gets a value that represents the dictionary that contains the properties. (See code below)

Property commmonProperties = project.Properties.Item("CommonProperties");
IDictionary dicCommonProps = commmonProperties.Value as IDictionary;
string projKeyFileName = dicCommonProps[DictionaryTags.AssemblyKeyFile].ToString();

In the example, I get the name of the file that contains either the public key using the DictionaryTags.AssemblyKeyFile enumeration.  This is the list that you can access in this dictionary.

 

Common Properties

Enumeration

Section: Assembly

Assembly Key Name: indicates the key container that contains the key pair passed as a parameter to the constructor of this attribute.

DictionaryTags.AssemblyKeyName

Assembly Key File: specifies the name of the file that contains either the public key or both the public and private keys passed as parameter to the constructor of this attribute.

DictionaryTags.AssemblyKeyFile

Assembly Delay Sign: value indicating that delay signing is being used.

DictionaryTags.AssemblyDelaySign

Assembly Title: specifies the title of the assembly.

DictionaryTags.AssemblyTitle

Assembly Description: specifies a short description that summarizes the nature and purpose of the assembly.

DictionaryTags.AssemblyDescription

Assembly Default Alias: specifies the default alias to be used by referencing assemblies.

DictionaryTags.AssemblyDefaultAlias

Assembly Configuration: specifies the configuration of the assembly, such as Development or Deployment.

DictionaryTags.AssemblyConfiguration

Assembly Trademark: specifies the trademark information.

DictionaryTags.AssemblyTrademark

Assembly Product: specifies the product information.

DictionaryTags.AssemblyProduct

Assembly Informational Version: specifies the version information.

DictionaryTags.AssemblyInformationalVersion

Assembly File Version: specifies the Win32 file version.

DictionaryTags.AssemblyFileVersion

Assembly Copyright: specifies the copyright information.

DictionaryTags.AssemblyCopyright

Assembly Company: specifies the name of the company.

DictionaryTags.AssemblyCompany

Assembly Version: number that represent the version of the assembly.

DictionaryTags.AssemblyVersion

Assembly Culture: indicate the culture that the assembly supports.

DictionaryTags.AssemblyCulture

Section: References Path

References Path: Lists the directories to search when the project is loaded for assemblies referenced by the project. This setting is specific to the project, computer, and user for which it is set. A relative path specification will be converted to, and stored as a fully-qualified path. Relative paths are assumed to be relative to the project directory.

DictionaryTags.ReferencesPath

Section: General

Project Folder: the full path to the project directory.

DictionaryTags.ProjectFolder

Project File: the name of the file containing build, configuration, and the information about the project.

DictionaryTags.ProjectFile

Default Namespace: specifies the default namespace for added items, such as classes, that are added via the Add New Item Dialog Box.

DictionaryTags.DefaultNamespace

Assembly Name: the name of the output file that will hold assembly metadata.

DictionaryTags.AssemblyName

 

 

DictionaryTags Enumeration 

The DictrionaryTags enumeration class is use to access each property, this class can be found in Microsoft.BizTalk.Studio.Extensibility.dll assembly.  See the structure below.

public enum DictionaryTags{
OutputPath,
WarningLevel,
TreatWarningsAsErrors,
EmbedTrackingInformation,
GenerateDebuggingInformation,
BpelCompliance,
Server,
ConfigurationDatabase,
ApplicationName,
Redeploy, Register,
RestartHostInstances,
AssemblyName,
DefaultNamespace,
ProjectFile,
ProjectFolder,
ReferencesPath,
AssemblyCulture,
AssemblyVersion,
AssemblyCompany,
AssemblyCopyright,
AssemblyFileVersion,
AssemblyInformationalVersion,
AssemblyProduct,
AssemblyTrademark,
AssemblyConfiguration,
AssemblyDefaultAlias,
AssemblyDescription,
AssemblyTitle,
AssemblyDelaySign,
AssemblyKeyFile,
AssemblyKeyName, None
}

 Friday, March 24, 2006
Friday, March 24, 2006 4:17:47 AM (GMT Standard Time, UTC+00:00) ( )

I have listened many times, how can I get a message context property from a map?  Well, while I was playing with the framework of BizTalk Server 2006 RC I found the way to do a functoid that implements this functionality.  I’ll try to explain how I do it below.

First, I have to know three values:

Message Name: the name of the message that have the context property
Property Name: the name of the context property
Property Namespace: the namespace of the context property

Second, I need to get the segments of the service (orchestration) and check in each segment if the message that I’m looking for is there.  The messages aren’t stored directly in the service; the messages are stored in the segments that exist inside the orchestration.  Normally one orchestration has two segments and one more segment when the orchestration implements compensation; the message normally is stored in the second segment (I really don’t know why the segments exist, this is an internal architecture from Microsoft and there isn’t information about that).

Third, when I find the particular message I check the context property (formed by Property Name and Property Namespace) inside the message and return its value.

This is the code that I have used:

// set the property
string property = "";
// get the service
Microsoft.XLANGs.Core.Service s = Microsoft.XLANGs.Core.Service.RootService;
foreach (Microsoft.XLANGs.Core.Segment seg in s._segments)
{
// find the real name of the message
foreach (DictionaryEntry de in Microsoft.XLANGs.Core.Context.FindFields(typeof(Microsoft.XLANGs.BaseTypes.XLANGMessage), seg.ExceptionContext))
{
// check that the key ends with the name of the message
if (de.Key.ToString().EndsWith(val1))
{
// get the message as a XLANGMessage
Microsoft.XLANGs.Core.XMessage msg = de.Value as Microsoft.XLANGs.Core.XMessage;
// if the message was found, then I get the value of the property
if (msg != null)
{
// create a XmlQName instance
Microsoft.XLANGs.BaseTypes.XmlQName qName = new Microsoft.XLANGs.BaseTypes.XmlQName(val2, val3);
// find the message property in the message
if (msg.GetContextProperties().ContainsKey(qName))
{
// get the property from GetContextProperties
property = msg.GetContextProperties()[qName].ToString();
}
else if (msg.GetContentProperties().ContainsKey(qName))
{
// get the property from GetContentProperties
property = msg.GetContentProperties()[qName].ToString();
}
}
break;
}
}
if (property.Length > 0)
break;
}
// return the property value
return property;

Exception :(

Unfortunately this functoid ONLY works if it is invoked from an orchestration… I mean a map inside an orchestration.  The reason is simple, to access to Message I have to get the current context of the service and this service is represented by the orchestration, if the orchestration doesn’t exist I cann’t get the context.

You can download the functoid assembly from GetContextProperty Functoid Workspace

This functoid was developed with the framework of Microsoft BizTalk 2006 RC using the Microsoft.XLANGs.Engine.dll and Microsoft.XLANGs.BasTypes.dll assemblies.  I hope that this functionality exists in the RTM version.

 Thursday, March 16, 2006
Thursday, March 16, 2006 4:15:48 AM (GMT Standard Time, UTC+00:00) ( )

Sometimes, in own orchestrations we need to know if a message context property exists inside one message in particular.  Well, the exists operator is useful in this situation.

The exists operator can be use in Filter expressions or Decide shapes.  The filter expression can determine if a message is welcome in the orchestration or not, and you can use the exists operator to allow messages that contain one or various message context property incoming to process.

But, if you need to take a decision about what way to follow when a message context property exists or not in the message you can use a Decide shape and the exists operator.  The syntax to exists operator is: PropertyName exists MessageName.

For example, if you need to know if the BTS.AckFailurecategory property is inside the message, you must use this expression: BTS.AckFailureCategory exists MessageIn

 Wednesday, March 15, 2006
Wednesday, March 15, 2006 4:15:04 AM (GMT Standard Time, UTC+00:00) ( )

I have developed a new version of BTSEasyReflector.  This new version include the refactoring of the code (I tried to simplify the code), new icons to represent visually each biztalk artifact, and - at last - I added two new classes to write dynamically the properties of each artifact using reflection.

You can visit and download it from BTS Easy Reflector

Note this version was developed with VS .Net 2005 and BizTalk Server 2006 RC.  If you have any question or suggestion, pls send me it to carlos1254@hotmail.com

 Saturday, March 11, 2006
Saturday, March 11, 2006 4:14:18 AM (GMT Standard Time, UTC+00:00) ( )

Microsoft has added new features and changed others in WMI provider to BizTalk Server 2006.  These features include:

  • add two new class MSBTS_SendHandler2 and MSBTS_TrackedMessageInstance2
  • remove the MSBTS_ServiceInstance.ServiceInstanceID property
  • change the definition (properties and methods) of 7 classes

I show below the complete list of changes:

MSBTS_GroupSetting Class

Properties

(+) BizTalkOperatorGroup: Gets the name of the BizTalk Administrator Microsoft® Windows® NT® Group

MSBTS_Host Class

Methods

(+) Cluster: Clusters all BizTalk Host Instances of the given BizTalk Host

(+) GetClusterResourceGroupNames: Returns List of cluster resource groups available

(+) UnCluster: Un-Clusters all BizTalk Host Instances of the given BizTalk Host

MSBTS_HostInstance Class

Properties

(+) ClusterInstanceType: This property tells whether the BizTalk Host Instance NT service is clustered

MSBTS_HostSetting Class

Properties

(+) ClusterResourceGroupName: When the host instances of this host are clustered, this property contains the cluster resource group name set by the Administrator

(+) DBQueueSizeThreshold: Maximum number of items in the Database

(+) DBSessionThreshold: Maximum number of DB Sessions (per CPU) allowed before throttling begins

(+) DeliveryQueueSize: Size of the in-memory Queue that the host maintains as a temporary placeholder for delivering messages

(+) GlobalMemoryThreshold: Maximum System-wide Virtual Memory (in percent) usage allowed before throttling begins

(+) InflightMessageThreshold: Maximum number of in-memory in-flight messages allowed before throttling Message Delivery begins

(+) IsHost32BitOnly: This property indicates whether the host instance process should be created as 32-bit on both 32-bit and 64-bit servers

(+) MessageDeliverySampleSpaceSize: This property indicates the number of samples that are used for determining the rate of the Message Delivery to all Service Classes of the Host

(+) MessageDeliverySampleSpaceWindow: Time-window (in milliseconds) beyond which samples will be deemed invalid for consideration

(+) MessageDeliveryOverdriveFactor: Percent factor by which the system will overdrive the Input rate for Message Delivery Throttling

(+) MessageDeliveryMaximumDelay: Maximum Delay (in milliseconds) imposed for Message Delivery Throttling. Zero indicates disable Message Delivery Throttling

(+) MessagePublishSampleSpaceSize: Number of samples that are used for determining the rate of the Message Publishing by the Service Classes

(+) MessagePublishSampleSpaceWindow: Time-window (in milliseconds) beyond which samples will be deemed invalid for consideration

(+) MessagePublishOverdriveFactor: Percent Factor by which the system will overdrive the Input rate

(+) MessagePublishMaximumDelay: Maximum Delay (in milliseconds) imposed for Message Publishing Throttling. Zero indicates disable Message Publishing Throttling

(+) ThreadPoolSize: Maximum number of messaging engine threads per CPU

(+) ThreadThreshold: Maximum number of threads in the process (per CPU) allowed before throttling begins

(+) ProcessMemoryThreshold: Maximum Process Memory (in percent) allowed before throttling begins

MSBTS_ReceiveLocation Class

Properties

(+) EncryptionCert: Contains the Name of the certificate used for outbound encryption

(+) SendPipeline: Represents the name of the pipeline that will process outbound documents

(+) SendPipelineData: Contains the custom configuration data for the SendPipeline

MSBTS_ReceivePort Class

Properties

(+) RouteFailedMessage: Controls whether failed messages have to be routed to failed message subscribers

(+) MSBTS_SendHandler2 Class

Properties

(+) AdapterName: Contains the name of the adapter used by the given instance

(+) CustomCfg: Contains adapter-specific configuration in XML format

(+) HostName: Contains the name of the BizTalk Host for this transport handler

(+) HostNameToSwitchTo: Contains the name of the BizTalk Host that this transport handler should switch to

(+) IsDefault: Indicates whether the send handler is the default one for this adapter type

MSBTS_SendPort Class

Properties

(+) OrderedDelivery: Determines whether the port should send messages in an ordered manner

(+) StopSendingOnFailure: Controls how EPM handles failures for order delivery enabled send port's primary transport

(+) RouteFailedMessage: Controls whether failed messages have to be routed to failed message subscribers

MSBTS_ServiceInstance Class

Properties

(-) ServiceInstanceID: Contains the ID of the service instance to which this message belongs

(+) MSBTS_TrackedMessageInstance2 Class

Properties

(+) MessageInstanceID: Contains the ID of the message

(+) PartCount: Number of message parts

(+) SourceDBName: Name of the SQL database where the tracked message is stored

(+) SourceDBServerName: Name of the SQL Server where the tracked message is stored

Methods

(+) SaveToFile: This method saves message context and parts into multiple output files

(+) this feature has been added
(-) this feature has been removed

Note: this information was based on BTS 2006 RC documentation, thus, is possible that these features change in BTS 2006 RTM version.

 Thursday, February 16, 2006
Thursday, February 16, 2006 4:12:51 AM (GMT Standard Time, UTC+00:00) ( )

Microsoft.BizTalk.Deployment.dll is an unsupported assembly provided by Microsoft, it is used to perform all actions related with the deployment of EAI solutions in BizTalk Server 2006 Beta 2.  This assembly provides classes to import, export, add and remove resources, register and unregister assemblies in the gac, and so on....

Additionally, with Microsoft.BizTalk.Deployment.dll you can extract the artifacts contained inside a biztalk assembly (.dll) using its classes and interfaces.  For example, if you want to know if a file is a biztalk assembly you can use this code:

if (BizTalkLatamAssembly.BtsAssemblyManager.IsBizTalkAssemblyByPath(pathBtsAssembly))
{
// crate an instance of BizTalkAssembly
Microsoft.BizTalk.Deployment.BizTalkAssembly biztalkAssembly =
new Microsoft.BizTalk.Deployment.BizTalkAssembly();
biztalkAssembly.Load(pathBtsAssembly);
// create an instance of BtsAssemblyManager
Microsoft.BizTalk.Deployment.Assembly.BtsAssemblyManager btsAssemblyManager =
new Microsoft.BizTalk.Deployment.Assembly.BtsAssemblyManager(pathBtsAssembly, biztalkAssembly);
// load the BtsAssembly from BtsAssemblyManager
Microsoft.BizTalk.Deployment.Assembly.btsAssembly = btsAssemblyManager.BtsAssembly;
}

Also, you can get the pipelines from a biztalk assembly using BtsAssembly class and IBizTalkOrchestration interface, see below:

IEnumerator listOfPipelines = btsAssembly.AssemblyMetaData.Pipelines;
listOfPipelines.Reset();
while (listOfPipelines.MoveNext())
{
Microsoft.BizTalk.Deployment.MetaDataOM.IBizTalkPipeline pipeline = listOfPipelines.Current
as Microsoft.BizTalk.Deployment.MetaDataOM.IBizTalkPipeline;
System.Console.WriteLine("Pipeline name: " + pipeline.Name);
}

I wrote an easy sample called "BTS Easy Reflector" that uses the classes of Microsoft.BizTalk.Deployment.dll to show information about a biztalk assembly.  You can download it from "BTS Easy Reflector: Workspace home" and send me your feedback.

This information and project was developed with BizTalk Server 2006 Beta 2, thus, is possible that it doesn't work to final relase .