by stephen-w-thomas | Aug 8, 2006 | Stephen's BizTalk and Integration Blog
This was a question (paraphrased) on the BizTalkGurus.com Forum: “How can I take email attachments and put them as is into a folder?”
When using the POP3 Receive Adapter, you have the ability to receive multiple items as attachments and the adapter will handle them using MIME processing. You do not need a custom pipeline.
When receiving a multi-attachment message, you have the ability to define one of the parts as the main message Body. If you leave the default (0), the email message body will be the main message Body and all attachments will be additional parts to the message.
Lets say you have 3 attachments and you want to receive in an email and write them out to disk in a folder location (you can always publish them to the message box and do anything you want with the messages). You could probably use a custom pipeline to break out the multi-part message into separate messages…
I found a very simple and straight forward approach to accomplish this task. The Orchestration looks like this:
The key is to create an Orchestration variable of type Microsoft.XLANGs.BaseTypes.XLANGMessage. In order to do this, you need to add a reference to Microsoft.XLang.BaseTypes.dll. Once you have this variable, you just need to set it equal to your input message like: oXMessage = In.
You now have access to everything the XLangMessage has available; most importantly Count and access to all the message parts. Now a simple loop can be used to loop over the parts and create new output messages for each message part.
The output messages are created like: Out = oXMessage[n] were n is the message part index (starting at 1 since 0 is the Body). It’s that simple. It’s a total of 4 lines of code inside the Expression Shape and Message Construct.
I have a sample solution available for download below.
Download: Splitting POP3 Email Attachments in BizTalk Server 2006
See the readme.txt file for set up information.
by stephen-w-thomas | Aug 7, 2006 | Downloads
This sample shows how to use MSBuild (available with Visual Studio 2005) to build, deploy, and undeploy a BizTalk 2006 Solution. This sample does not use an MSI or a binding file and build, binds, and deploys all BizTalk and .Net code using MSBuild Tasks. This sample uses the custom tasks developed by Microsoft UK and available on GotDotNet.
This sample will work with BizTalk 2006 and BizTalk 2006 R2.
Get more information from the original blog post on this topic: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2006/08/07/how-to-build-and-deploy-biztalk-solutions-using-msbuild.aspx
by stephen-w-thomas | Aug 6, 2006 | Stephen's BizTalk and Integration Blog
MSBuild is the new build platform for Visual Studios. It allows great flexibility, customization (through creating custom Tasks), and integration with unit tests.
While MSBuild doesn’t directly support building BizTalk solutions, tasks are available to call the DEVENV executable and Microsoft UK has released a set of custom tasks to support a wide verity of common BizTalk tasks (available on GotDotNet). This provided an easy method for scripting automated or ad-hock BizTalk builds and deployments using MSBuild.
What can MSBuild do for you?
– Allow for automated and scheduled builds of your BizTalk code
– Extract code from Team Foundation Server (or other source control)
– Run unit tests
– Deploy BizTalk code to local or remote servers
– Control your overall BizTalk deployment by removing past solutions, stopping applications, and terminating Orchestrations
I have put together a sample to show the power and flexibility of using MSBuild for you BizTalk Build, Deployment, and Undeployment.
Download: BizTalk 2006 Build and Deployment with MSBuild
(Note the download included the custom BizTalk task binary files from GotDotNet and required license file.)
This solution provides a sample of how to set up a MSBuild script to build, deploy, and undeploy a BizTalk 2006 Solution. This solution has multiple projects and custom .net code. I also use MSBuild to create all required Send and Receive Ports and bind them to the Orchestration.
The whole build and deployment process does not use a MSI or a binding file. Although, I would have used a binding file but I wasn’t able to get the custom task to work correctly. This approach might not be the best solution to your deployment needs, but is intended to show you what can be done and how.
To run the sample, it must be extracted to your C drive unless you manually edit the configuration files. Once extracted, open a Visual Studio 2005 command window, change your path to C:\SampleDeployment, and type: MSBuild Build.proj to build and deploy the code. To undeploy the solution type: MSBuild UnDeploy.proj
The Build.proj will automatically do an undeployment if needed. This sample has only been tested with a local deployment and I was not able to get it to work remotely on my home environment. I need to do some more research on this.
In case you get lost in all the files, the FullBuild.proj is the full undeploy, build, and deploy in one file. All MSBuild files have been commented so it should be easy to follow what is going on.
Key files and what they do:
Build.proj – this is basically a control file. It imports Build.properties, Undeploy.targets, and Deploy.targets.
Undeploy.proj – this is another control file. It imports Build.properties and Deploy.targets. It is used if you just want to undeploy the solution.
Build.properties – this contains solution specific information like the solution name, dll names, application name, and so on. In theory, this should be the only file you need to update (except I hard coded all the port info into the Build.targets file)
Undeploy.targets – this set of targets handles the termination of running Orchestrations, stopping the Application, and removes the items from the GAC.
Deploy.targets – this set of targets builds the BizTalk solution, creates the Application, creates the ports, deploys the BizTalk assemblies, binds ports to the Orchestration, and starts the Application.
FullDeplou.proj – this file is the same as Build.properties, Undeploy.targets, and Deploy.targets except it has all the targets in one file.
One huge time saver I found when working with the custom tasks from GotDotNet is to download the source code. This way you can view the custom tasks, understand input parameters, and see required fields. It’s a huge time saver.
What’s on the horizon? Integration with BizUnit, FTS, multiple deployment options (like Dev, Test, Prod), and testing the remote deployment support. I hope to post more on these topics later on.
by stephen-w-thomas | Jul 26, 2006 | Stephen's BizTalk and Integration Blog
AppDev Training is offering a free CD Training Class!
They have many great courses to pick from including a new Microsoft BizTalk Server 2006 course called “Exploring BizTalk Server 2006”.
If you are new to BizTalk 2006, this looks like it would be an excellent opportunity to get 3 hours worth of free training. This CD covers the new features and functionally in BizTalk 2006.
Some other titles available are:
Exploring ASP.NET “Atlas” and Web 2.0
Exploring SQL Server 2005
It looks like this offer is also valid internationally but you have to pay shipping costs.
Oh, make sure you create a user account before you add anything to your cart. When I signed up, it seemed to clear my shopping cart. Also, if you get lost look for the “Free Training” button on the right side of the home page to get back to the free offer.
by stephen-w-thomas | Jul 20, 2006 | Stephen's BizTalk and Integration Blog
Recently I have been working a lot with BizUnit 2.0 (Available on GotDotNet). This framework provides an easy and customizable way to unit test your end to end BizTalk solutions. I’ll not get into details about BizUnit right now since this post is focused on Visual Studios 2005 Code Snippets.
Young Jun has developed a set of code snippets for BizUnit 2.0 for use with Visual Studios 2005. Although not all the BizUnit tasks are included, it is a huge time saver when building unit test files.
The only problem I had was how to install the snippets. I found it a little tricky so here are the steps I went through.
Installation:
1. Download the code snippets.
2. Unzip them to a folder, in my case C:\BizUnit
3. Open Visual Studios and locate the Code Snippets Manager under Tools.
4. If you do not see it listed, you will need to go to Customize under Tools, look under Commands, Tools, and move the command to the Tools menu.

5. Change the Language to XML

6. Select the Add button and select the folder with your snippet (in my case C:\BizUnit)
7. Click OK.
8. You are all set. Now when you open an Xml document inside Visual Studios you will see the BizTalk Snippets available
More to come on BizUnit in later posts.
by stephen-w-thomas | Jul 17, 2006 | Stephen's BizTalk and Integration Blog
SQL Server 2005 offers many exciting new features. One of them is the support for Xml as a data type. On the surface, this looks great since BizTalk likes Xml. But, we come to learn that the Xml Data Type is not supported using the SQL Adapter inside BizTalk.
But, with a little effort you are easily able to accept Xml Documents that are all in one cell from SQL Server into BizTalk using the Receive Adapter.
Here is the scenario: The client is using a SQL table as a type of queue. Messages are writing as full Xml Documents into a single cell of the table, along with an id, datetime, and a status. This data needs to be inserted into BizTalk. In the past, I have used a windows service to send the messages to a MSMQ queue and then into BizTalk. My new approach is to use a simple stored procedure that I call from a Receive Port to extract out the Xml and update the states on the table.
In addition, you can use one Receive Location to receive many different message types. Then you can use message box routing (Direct Binding) to route many different message types to Send Ports or Orchestrations. You can also map on the Receive Port if needed.
The downside is you can not auto generate the schema using the SQL Schema Generation Wizard. You will need to generate them manually based on the Xml messages you will be putting into your queue table.
I have put together a sample complete with a sample database, stored procedure, and BizTalk code.
Download: Working with SQL 2005 XML Data in BizTalk 2006 Sample
This includes an importable MSI and Binding files if you want to build the code yourself. See the readme.txt file for more set up information.
by stephen-w-thomas | Jul 17, 2006 | Downloads
This sample uses a simple stored procedure to extract out data as XML from SQL Server 2005. Using this approach, you can receive many different messages through one Biztalk Receive Location.
This sample will work with BizTalk 2006 and BizTalk 2006 R2.
Get more information from the original blog post on this topic:http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2006/07/17/how-to-receive-sql-xml-data-into-biztalk-server-2006.aspx
by stephen-w-thomas | Jul 11, 2006 | Stephen's BizTalk and Integration Blog
A few weeks ago Microsoft released an updated version of the documentation for BizTalk 2006.
You can download the updated docs here.
The new content has some really good stuff including:
– Complete documentation for all BizTalk Server Line of Business Adapters, including new tutorials, one for each adapter. See the section “Using Adapters.”
– Disaster recovery instructions for backing up and restoring your BizTalk Server and databases. See the section “Backing Up and Restoring BizTalk
Server”
– Information for improving fault tolerance. See the section “Planning and Architecture”
The only thing is the download is over 40 MB and it is in .chm format. So, this will not replace your existing BizTalk Documentation but rather provide you a second full version of documentation. Not sure why it is packaged like that…
by stephen-w-thomas | Jul 10, 2006 | Stephen's BizTalk and Integration Blog
First off, it has been a long time since I’ve last blogged. I have been very busy working on some other endeavors and I was on vacations for a few weeks. I am now working on some new blog posts and samples so I can get back into the swing of things.
Recently, I have been working with Enterprise Library for .net 2.0. I was able to get basic logging set up and working with little effort using this static method call:
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(oLogger);
Were oLogger is an instance of Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry. To get this to work, all I had to do was add a reference to Microsoft.Practices.EnterpriseLibrary.Logging and I was all set.
Now, I was trying to add a category so I can separate out tracing messages from error messages. The call looks like this:
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(oLogger, “Trace”);
With “Trace” being a string for the category.
When I try to build this inside Visual Studios 2005, I get an “unknown system exception”.
I am not really sure why this is happening. I’m guessing it is because internally categories are a Generic Collection and for whatever reason when I define a category the BizTalk compiler can not handle it?
I was able to find a simple work around that accomplished my goal. I created a simple .net helper class to wrap the static method call. Rather than using the overload to the Write method that takes in a category, I am now able to add the category to the collection. The helper method looks like this:
static public void myLog(Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry Message, string Category)
{
// Clear the collection first to make sure nothing is already in there
Message.Categories.Clear();
// Add the one category needed for logging
Message.Categories.Add(Category);
// Make the static method call for logging
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Message);
}
I’m now able to set up two categories in the configuration file to accept trace events and error conditions.
by stephen-w-thomas | Apr 27, 2006 | Stephen's BizTalk and Integration Blog
Wow, the guys at Two Connect have been very busy. They have released three new adapters for BizTalk Server 2006.
They are:
- SalesForce.com (integrated with them in the past through .net as a BizTalk Adapter would be great)
- Web Services Enhancements (WSE) 3.0
- SQL Server Service
They have some upcoming web casts along with members of the Microsoft Product Teams to cover these exciting new adapters.
Make sure you check them out. You can get more information on Jesus Rodriguez blog.