Host /Host Instance Creation and Adapter Configuration Tool for BizTalk Server

I’ve put together a new BizTalk Tool available for download on BizTalkGurus.com.

This tool will do the following:

– Create Hosts

– Create Host Instances

– Assign Adapters to the new Hosts

This tool can early be set up using a Configuration file and will allow for a consistent server setup throughout your environments.

It also has the option to prompt the user for account passwords at run time and set all Adapters back to the default host.

You can download the tool here and get more information here.

Creating Multi-Part Messages in BizTalk

Creating Multi-Part Messages in BizTalk

Last year I wrote an entry about adding arbitrary
binary attachments
to a Multi-Part message in BizTalk 2006 using a helper C# component.
That entry has been fairly popular (as far as BizTalk posts go, which is not usually
much!), and I occasionally get questions about it.

The sample uses a bit of clever code to insert arbitrary attachments into an existing
XLANGMessage instance during construction. However, it’s not very clear that this
is actually a supported scenario and so there’s always a chance it might get you into
trouble.

I recently thought of another way, possibly much better supported to accomplish the
same in BizTalk 2006, though with a little performance hit: Use the Invoke Pipelines
feature in BizTalk 2006 Orchestrations.

Basically, the idea would be to create a custom pipeline component (depending on what
you need it could be a regular encoding/pre-assemble or an assembler component), generate
a new multi-part message in it, and return that to the orchestration.

I haven’t tried it yet, but I think it should work.

technorati BizTalk

BizTalk Host Creation and Adapter Assignment Tool Available for Download

What is one of the biggest problems with having to set up BizTalk in a new Environment?  Creating all the Hosts, Host Instances, and assigning the Adapters to these new hosts.  This process has been made much simpler with the help of the BizTalk Host Setup Tool.

This tool is fed by a configuration file to set up the Hosts, install Host Instances, and assign Adapters to those Hosts.  This tool also has the ability to prompt for a user password and reset all the Adapters back to the default Host (this was used extensively when I was testing the tool).

This will allow one developer to create the solution host layout and easily distribute it to others!

How should you set up your Hosts?  For starters, you should have a Receive Host, a Send Host, a Process Host, and a Tracking Host.  Then, continue to build out the Hosts as needed.  In general, it is best for each Adapter to run in its own Host.  But I’m a big fan of not taking this to extremes – specifically on single or double server BizTalk installations.

This tool will help you design and build your solutions by making it easy to separate out your processes into multiple hosts even on your developer boxes.  It will also make sure all your developers and environments are using Hosts with the same names – a total nightmare to manage.

You can find the download here.

Note: This is intended as a starting point and you are free to build off of it and customize it as needed.  It is nothing exciting as I am just wrapping WMI calls with what I hope is more user friendly XML tags.  Please remember this and all other code on BizTalkGurus.com is AS-IS and not intended for production use.

I have included two sample config files.  The two samples are HostConfig-Demo.xml and HostConfig.xml. Both have comments that should make it easy to figure out what is going on.

I have not tested this tool with remote setups or on anything other than BizTalk 2006 R2 (but anything 2004 to present should work).

Here is a sample of the XML Configuration File:

<BizTalkHostConfig Version=”1.0″ defaultHost=”BizTalkServerApplication” defaultIsoHost=”BizTalkServerIsolatedHost”>
    <MakeHosts>
        <!– Basic Sample to create a HOST
            <Host>
            <HostName>MyTestHost</HostName>
        Host Type: Isolated or InProcess
            <Type>InProcess</Type>
            <NTGroup>BizTalk Application Users</NTGroup>
            <AuthTrusted>false</AuthTrusted>
        Action: true to install or false to skip
            <InstallServers Action=”false” />
        Action: true to set adapters or false to skip
            <SetAdapters Action=”false” />
        AdapterName Type: Receive or Send
        </Host>
        Detailed sample to create a host, install it, and set up an adapter to use the new host
        <Host>
            <HostName>MyTestHost123</HostName>
        Host Type: Isolated or InProcess
            <Type>InProcess</Type>
            <NTGroup>BizTalk Application Users</NTGroup>
            <AuthTrusted>false</AuthTrusted>
        Action: true to install or false to skip
            <InstallServers Action=”true”>
                <Server>
        Start: true to start host or false to not
                    <ServerName Start=”true”>LPT154</ServerName>
                    <UserName>SomeUserSomePassword</UserName>
        Prompt: true to get a pop up to end password or false to enter it here
                    <Password Prompt=”false”>SomeUserSomePassword</Password>
                </Server>
            </InstallServers>
        Action: true to set adapters or false to skip
            <SetAdapters Action=”true”>
                <Adapter>
        Type: Receive or Send
                    <AdapterName Type=”Receive”>File</AdapterName>
                </Adapter>
            </SetAdapters>
        </Host>
        –>
</BizTalkHostConfig>

Enjoy! 

Host Instance Creation and Adapter Configuration Tool for BizTalk

This tool will help you design and build your BizTalk solutions by making it easier to consistently separate out your processes into multiple hosts even on your developer boxes.  It will also make sure all your developers and environments are using Hosts with the same names.  This can be a total nightmare to manage and maintain.

This tool is fed by a simple config file to set up the Hosts, install Host Instances, and assign Adapters to these new Hosts.  This tool has the ability to prompt for a user password and reset all the Adapters back to the default Host (this was used extensively when I was testing the tool).

This tool should work with BizTalk Server 2004, BizTalk Server 2006, and BizTalk Server 2006 R2.  I have not tested it running against any remote servers. 

For more information, see the full blog post at: https://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2008/04/30/biztalk-host-creation-and-adapter-assignment-tool-available-for-download.aspx

SSO Database – external credentials are more recent

Hey folks – while flying through different timezones and working away on my VPCs I
came across the problem below.

Basically no further work could be done on the Application within the BizTalk Admin
Console.

 

Couldn’t stop/start, undeploy…delete etc.

 

The only thing I had done was to adjust my time to reflect local time….which as
I found out causes the problem.

 

I adjusted my clock back to Sydney time and we’re good to go!!!

 

Trap for young players……

 

 

SSO AUDIT
Function: SetConfigInfo
Tracking ID: df1dd0b0-c9d5-4012-bb97-336aa8df78b3
Client Computer: BTS06-Platform.contoso.com (mmc.exe:1884)
Client User: BTS06-PLATFORM\Administrator
Application Name: {D2241406-0767-4C13-98EB-43EECE80F8A0}
Error Code: 0xC0002A40, The external credentials in the SSO database are more recent.

Thomson Elite 3E – introduction

Wanted to start writing about our experiences with using the product.

We have just been awarded a contract to enhance some of the functionality in the product.

I don’t have a lot of information about the product other than the Thomson’s product site, some press release information, and Karen Jones singing it’s praises (there are some questionable pictures on this last blog page, so look at it at home!).

Keep your eyes on this Thomson category, as I explore what we are doing and how others might benefit from our enhancements.

By the way, if you have any experiences, feel free to contact me through the blog’s contact page, or you can contact me (Eric) directly on the contact information page, or even feel free to post a comment to this entry.

BizTalk: Architectural Tips: Custom Audit

The audit can be implemented by BizTalk Tracking (BizTalkDTADb) database.
But there is one big “But”. This database has predefined, undescribed structure, it should be used only by special BizTalk tools as HAT. We cannot change the audit points, cannot freely create user queries, cannot change structure of this database.
It is not so hard to create the custom audit, it is the standard practice to make the custom audit database and gather data for it from the BizTalk application with additions for the Orchestrations.
It is good practice to use some standard for the audit architecture. Here I give you two of them.
They are pretty easy and repeat the “Generic Error handling” pattern. They use the Direct port subscription.
I. One audit send port, the audit messages are created in different ways. All audit messages have the same message type. The Audit send port is subscribed to the one audit message type.
II. One audit send port with set of the maps, the audit messages are created by these maps.The Audit send port group is subscribed to the all audited message type.
We create the standard audit message type; send all audit messages in all audit points to the Direct send port shape; create the Direct send port with subscription to this audited message type. That is all.
[The audit points are the all audited milestones as receiving/sending themessage; transforming themessage; routing the message , etc.]
ToDo list:
  1. Create the generic_audit schema. It can, for example, include elements: “Operation datetime”, “Operation type”(Send/Receive/…), “Original message parameter (like File Name)”, “Success/Fail status”, “My_Specific_parameter” etc.
  2. Create simple maps to produce the generic_audit schema from all other messages. It is not necessarily all audit parameters be mapped from the source message. Some of them might be produced inside map or expressions, for example, the “Operation datetime” parameter.
  3. Create the Audit Send Direct port with these maps in the entry.Make filters for all audited message types, i.e. subscribe to all these message types.
  4. If we want to save the audited messages in the database: Create the Audit database. The simplest database might be with one table and one stored procedure to fill-in this table.
FYI You can see in MSDN forum (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2452186&SiteID=1) a comment of Kent Weare [BizTalk MVP] about using BAM for auditing:

“…On at least a couple of occasions I have heard MS employees endorse BAM for auditing. We brought a Microsoft consultant to review our architecture and design with respect to auditing. He suggested we use BAM for this purpose. Note he did not endorse message body tracking inside of BAM. The other place that I have seen it endorsed is at TechEd at one of Darren Jefford’s sessions.
Without a doubt building up the required BAM infrastructure is not a trivial task(especially in an enterprise scenario). Keeping things simple is often the best solution, so I do think that you have brought up some valid points. …”

One more discussion about using HAT to tracking messages is here (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1991237&SiteID=1).

Testing BizTalk Applications

Found a great resource today for how to go about testing BizTalk applications.  It covers best practices on how to unit test various BizTalk artifacts such as schemas, maps, pipelines, orchestrations.  This covers how these should be covered with tests for integration testing as well as functional testing.  Very interesting read.
http://geekswithblogs.net/michaelstephenson/archive/2008/04/27/121687.aspx

BizTalk SQL Message Archive component using Forward-Only Streaming

A colleague of mine, Christoph Hanser, came to me with the idea you could use the UPDATETEXT command to stream data to a SQL database. This approach would work well with a forward-only streaming manner, which would consume much less (BizTalk) resources then reading the entire message in the pipeline and store it in the database as a BLOB.

Consider the content of this blog as an experiment, as it is not yet tested. -That said, archiving the message to a database could be preferred in many aspects such as security and maintenance

The advantage of forward-only streaming is that the message will only be read once. It relies on the BizTalk Message Engine to “pull” the message from its destination (through the adapter), and letting the pipeline component hook up the read events. For more information about Forward-only streaming see Johan Hedbergs blog post. 

This is basically done by encapsulating the incoming stream in a CForwardOnlyEventingReadStream and without reading it in the pipeline Execute method:

CForwardOnlyEventingReadStream eventingReadStream = 
new CForwardOnlyEventingReadStream(pInMsg.BodyPart.GetOriginalDataStream());

Now you register the read events:

eventingStream.BeforeFirstReadEvent += new BeforeFirstReadEventHandler(BeforeFirstReadEvent);

eventingStream.ReadEvent += new ReadEventHandler(ReadEvent);

eventingStream.AfterLastReadEvent += new AfterLastReadEventHandler(AfterLastReadEvent);

When the message finally hits the Message Engine, BizTalk will read the encapsulated stream, and trigger the events you’re interested in, such as the ReadEvent. This is where the fun starts. First I had to create the row in the table and get a handle to the column where I would store the message data:

SqlCommand command = new SqlCommand(
                "INSERT INTO [dbo].[ArchiveStore] " +
                "([InterchangeID] " +
                ",[Source] " +
                ",[Message]) " +
                "VALUES(@InterchangeID,@Source,@Message)" +
                "SELECT @Pointer = TEXTPTR(Message) " +
     "FROM [dbo].[ArchiveStore] " +
                "WHERE InterchangeID = @InterchangeID AND " +
                "[Source] = @Source", _connection);

command.Parameters.Add("@InterchangeID", SqlDbType.UniqueIdentifier).Value = _interchangeID;
command.Parameters.Add("@Source", SqlDbType.VarChar, 255).Value = _source;
command.Parameters.Add("@Message", SqlDbType.Image, args.bytesRead).Value = args.buffer;

SqlParameter ptrParm = command.Parameters.Add("@Pointer", SqlDbType.Binary, 16);
ptrParm.Direction = ParameterDirection.Output;

Now that got the handle I can update the [Message] column using the UPDATETEXT command in the ReadEvent:

_appendMessage = new SqlCommand(
    "UPDATETEXT ArchiveStore.Message @Pointer @Offset 0 @Bytes",
    _connection);

-That’s it! Download the code if you’re interested, but I must say I’m not sure archiving to the database is the best approach. I don’t say it isn’t, but I haven’t got around testing it yet.

Download sample here.

HTH