Exceptional Error Handling with BizTalk 2006 and InfoPath | CodeGuru

Exceptional Error Handling with BizTalk 2006 and InfoPath

Error handling and exceptions are the bane of all BizTalk integration projects. When too many errors occur, people begin to wonder why your company continues to use an integration application. It you automatically handle too many errors during development, your application will never advance beyond the testing stage. You simply cannot conceive of every possible […]

Written By
CodeGuru Staff
CodeGuru Staff
Jan 19, 2007
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Error handling and exceptions are the bane of all BizTalk integration projects. When too many errors occur, people begin to wonder why your company continues to use an integration application. It you automatically handle too many errors during development, your application will never advance beyond the testing stage. You simply cannot conceive of every possible error. At some level, you need to build human intervention into the application.

Human intervention for error handling often requires business knowledge as well as access to the tools to handle the exception. How do you allow for human intervention without requiring that all your application business users become BizTalk Server administrators or all your administrators become proficient business users? BizTalk 2006 failed message routing and InfoPath may be just the solution for you.

Using a sample garnered from the BizTalk 2006 SDK, this article shows how to implement human intervention features into your error handling.

Before jumping into the sample, an explanation of failed message routing would be helpful.

New in BizTalk 2006: Failed Message Routing

The BizTalk 2006 documentation includes a complete explanation of failed message routing. This section summarizes that documentation.

Failed messages are error messages resulting from processing errors in pipelines or adapters, or errors related to message routing. Thus, failed messages can result from exceptions on a send or receive port. So, for example, exceptions in a pipeline or a delivered message without subscribers would create a failed message.

Failed message routing is new in BizTalk 2006 and must be enabled on the port. Failed message subscribers can subscribe to information contained in the context of the error message. Error message context contains things such as port name, type of failure, and failure description. Subscribers can be either orchestrations or send ports.

You can use failed messaging for a variety of different error-handling scenarios ranging from simple notifications to a completely separate human workflow process. The sample in this article combines failed message routing with a BizTalk orchestration and InfoPath to fix errors and resubmit to BizTalk.

Sample Overview

The error-handling sample simulates an expense submission system. Figure 1 provides a graphic overview of the sample; Figure 2 shows where it is located.

Figure 1: Error-handling Sample Overview

Figure 2: Location of Error-handling Sample

Expenses are loaded into an InfoPath form (see Figure 3) and submitted to a simulated “backend” system via the BizTalk file adapter.

Figure 3: An InfoPath Form

For demonstration purposes, the backend systems are ExpenseReportIn and ExpenseReportOut folders. Only expenses from the Marketing department are accepted. Messages from other departments appear as error messages in the ExpenseReportOut directory. Errors are prefixed with Error and non-errors are prefixed with Expense. Figure 4 presents a sample error message.

Figure 4: Sample Error Message

A user is allowed to edit and resubmit the error message within an hour of receiving it. The orchestration called ResubmitLogic handles the error message routing and resubmission process. Now that you know what the error message sample does, find out how it works.

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.