Build BizTalk 2004 Custom Pipeline Components to Process Non-XML Data, Page 2
We also implemented a destructor for the custom Pipeline component so we could freeze the results on the Pipeline.exe utility as we ran the debugger from Visual Studio. Because the Pipeline.exe utility doesn't know the results of the Execute statement until you exit the Execute statement, you can freeze the execution of the utility by putting a breakpoint in the Destructor code of you custom Pipeline component object.
The IBaseMessage interface includes other things helpful for debugging and troubleshooting, including a property called Context. Context contains metadata about the message being sent through BizTalk. Because we used the File Adapter, the Context property includes information about the file collected by the File Adapter. The following code illustrates how you access the name of the file sent to the Pipeline:
originalFileNameObj = inmsg.Context.Read("ReceivedFileName", @"http://schemas.microsoft.com/BizTalk/2003/file-properties"); if (originalFileNameObj == null)
If you debug using the Pipeline.exe utility, the file Context information is blank. The information is populated during runtime. The sample code captures only the name of the file, but you can capture a variety of other pieces of information from the Context. For example, you can view a list of message namespaces and Context properties by accessing the Configuration menu-Message Properties in the Health and Activity Tracking (HAT) application (see Figure 3).
Figure 3. Access Configuration menu-Message Properties in the HAT Application
Add a Custom Component to the Pipeline
This article began by creating a Pipeline in a Visual Studio.NET BizTalk project. The final step is adding the custom Pipeline component to the Pipeline in the BizTalk .NET Assembly. After creating any custom Pipeline component, you must deploy the pipeline to the C:\Program Files\Microsoft BizTalk Server 2004\Pipeline Components directory so the custom Pipeline component can be added to the Pipeline in your BizTalk 2004 project. After you deploy the custom Pipeline component, you must add the component to the Pipeline component toolbar. To add the component, right-click the top of the Pipeline Component toolbar and select "add and remove items", as shown in Figure 4.
Figure 4. Right-Click the Top of the Pipeline Component Toolbar
Select the Pipeline Component on the Pipeline Toolbar tab (see Figure 5).
Figure 5. Select the Pipeline Component on the Pipeline Toolbar Tab
You can now drag and drop the custom Pipeline component onto the Custom Pipeline (see Figure 6).
Figure 6. Drag and Drop the Component onto the Custom Pipeline
You can now compile and deploy the new pipeline.
Handle Non-XML Data in BizTalk Messages
Pipelines allow you a great deal of control over the processing of BizTalk 2004 messages. Custom Pipeline components allow you to handle non-XML data in BizTalk messages coming through an adapter. For turning non-delimited ASCII text files into a BizTalk-consumable XML format, a custom Pipeline component is your best option.
Download the Code
To download the accompanying source code for this article, click here.
About the Author
Jeffrey Juday is a software developer with Crowe Chizek in South Bend, Indiana. He has been developing software with Microsoft tools for more than 12 years in a variety of industries. Jeff currently builds solutions using BizTalk 2004, ASP.NET, Sharepoint, and SQL Server 2000. You can reach Jeff at firstname.lastname@example.org.
Page 2 of 2