You are on page 1of 11

Microsoft Virtual Labs

Processing Flat Files


BizTalk Server 2006 R2: Processing Flat Files

Table of Contents

Exercise 1 Creating a Flat File Schema using the Flat File Schema Wizard .................................................................1
Exercise 2 Create a Receive Pipeline to Disassemble a Message Interchange ..............................................................4
Exercise 3 Enable and Test the Pipeline ........................................................................................................................5
Exercise 4 Configure and Test the Pipeline for Interchange Processing .......................................................................7
Exercise 5 Configure and Test the Pipeline for Recoverable Interchange Processing ..................................................8
BizTalk Server 2006 R2: Processing Flat Files

BizTalk Server 2006 R2: Processing Flat


Files
Objectives
After completing this lab, you will be able to:
• Create a schema using the Flat File Schema Wizard
• Create and configure a pipeline to use a flat-file disassembler component
• Configure the receive pipeline of a BizTalk receive location
• Configure pipeline for recoverable interchange processing

Scenario
You work for a book supplier who needs to be able to accept batched flat file
orders. You have been provided samples of a single order, a batched order that
contains three orders, and a batched order which contains bad data. You will
create a flat file schema for the order using the Flat-File Schema Wizard.
After you have created the schema you will create and test a custom pipeline
which will be used to process the single order flat file message.
Once the pipeline is configured to receive individual orders, you will configure it
to receive a process batched orders. You will then configure it to allow
recoverable interchange processing.

Estimated Time to
Complete This Lab 45 Minutes

Computers used in this


Lab
BizTalkServer2006R2VPC

The password for the Administrator account on all computers in this lab is:
pass@word1

Page 1 of 9
BizTalk Server 2006 R2: Processing Flat Files

Exercise 1
Creating a Flat File Schema using the Flat File Schema
Wizard
Scenario
In this exercise, you will use the Flat File Schema Wizard to create a schema which represents a single order.
You will specify the format of the records (positional or delimited) and then define the records, elements, and
attributes of the message. This schema will be used in later exercises to process flat file orders.

Tasks Detailed Steps


Complete the following a. If the machine has not been logged on, log on to the lab machine using the
tasks on: username: Administrator and password: pass@word1

BizTalkServer2006R2VPC

1. Log on to the lab


machine
2. Investigate the a. In Windows Explorer, navigate to and open
records contained C:\Labs\Work\LabA\Messages\OrderFF.txt.
in the document Note: Notice that the first line contains PO details, including the fact that this message is
for which you will indeed a Purchase Order, the customer name, the PO number, and the PO date.
be generating the The second line consists of the address of the customer in a standard US format
schema. including the street, city, state and zip or postal code.
The third line is a comment.The fourth line is the detail of the order. It contains a
recurring book record nested inside a books record. The book record contains the details
pertaining to individual items.
3. Open the BizTalk a. In Windows Explorer, browse to C:\Labs\Work\LabA, and then double-click
Server 2006 LabA.sln to open the solution.
Solution.
4. Add a flat file a. In Solution Explorer, right-click the RecoverableInterchange project, point to
schema to the Add, and then click New Item.
project. b. In the Add New Item dialog box, click Schema Files, and then click Flat File
Schema Wizard.
c. In the Name box, type FFOrder.xsd, and then click Add.
5. Define the schema Note: The Flat File Schema Wizard provides an intelligent user interface for
structure using the building flat file schemas. Everything that can be done using the Flat File Schema
Flat File Schema Wizard can be done using the BizTalk Editor.
Wizard. When a section of the message is specified as a Tag Identifier it will be removed
from the message when it is processed.
a. On the Welcome to the BizTalk Flat File Schema Wizard page of the BizTalk
Flat File Schema Wizard, click Next.
b. On the Flat File Schema Information page, click Browse.
c. In the Select a Flat File Document dialog box, browse to and select
C:\Labs\Work\LabA\Messages\OrderFF.txt, and then click Open.
d. On the Flat File Schema Information page, change the Record name to
Order, and then click Next.
e. On the Select Document Data page, ensure the entire message is selected, and
then click Next.

Page 1 of 9
BizTalk Server 2006 R2: Processing Flat Files
Tasks Detailed Steps
f. On the Select Record Format page, ensure that By delimiter symbol is
selected and then click Next.
g. On the Delimited Record page, ensure that Child delimiter is set to {CR}{LF},
select the Record has a tag identifier check box, then type PO in the Tag box,
and then click Next.
h. On the Child Elements page, change the properties for the Child nodes as listed
in the table below, and then click Next.
Element Name Element Type
PODetail Record
Address Record
Comment Field Element
Books Record
6. Define the Note: The PODetail record is comma delimited.
PODetail record. Notice that the first record, except the tag identifier and the carriage return/line feed
(¶«) is selected for you.
a. On the Schema View page, ensure that PODetail is selected, and then click
Next.
b. On the Select Document Data page, click Next.
c. On the Select Record Format page, ensure that By delimiter symbol is
selected and then click Next.
d. On the Delimited Record page, in the Child delimiter list, choose the comma
(,) symbol, and then click Next.
e. On the Child Elements page, change the Child nodes as listed in the table
below, and then click Next.
Element Name Element Type Data Type
OrderNumber Field attribute string
CustomerName Field attribute string
OrderDate Field attribute date
7. Define the Address Note: The Address node is a positional record.
record. The Flat File Schema Wizard provides a visual interface for determining the starting
points for each node. Previously, you would need to count each character to know
the where each node began.
a. On the Schema View page, ensure that Address is selected, and then click
Next.
b. On the Select Document Data page, click Next.
c. On the Select Record Format page, select By relative positions, and then click
Next.
d. On the Positional Record page, click the position to the left of each of the
elements. You should have an arrow on each of the following positions: 0
(default), 25, 40, 42.
e. Click Next.
f. On the Child Elements page, change the Child nodes as listed in the table
below, and then click Next.

Element Name Element Type


Street Field element

Page 2 of 9
BizTalk Server 2006 R2: Processing Flat Files
Tasks Detailed Steps
City Field element
State Field element
Postal Field element
8. Define the Books Note: The Book node will be repeated for any orders with more than one book. This
record means that it needs to be defined as a repeating record.
a. On the Schema View page, ensure that Books is selected, and then click Next.
b. On the Select Document Data page, click Next.
c. On the Select Record Format page, ensure that By delimiter symbol is
selected, and then click Next.
d. On the Delimited Record page, set the Child delimiter to the comma (,)
symbol, then select the Record has a tag identifier check box, then type Books
in the Tag box, and then click Next.
e. In the error dialog box, click OK.
Note: The Flat File Schema Wizard parses the message to verify that the tag
identifier is valid. Because the tag identifier is case-sensitive, ‘Books’ is not found
within the record, and an error is displayed.
f. Change the Tag box to BOOKS, and then click Next.
g. On the Child Elements page, change the Child nodes as listed in the table
below, and then click Next.
Element Name Element Type
Book Repeating Record
Books_Child2 Ignore
9. Define the a. On the Schema View page, ensure that Book is selected, and then click Next.
elements for the b. On the Select Document Data page, click Next.
Book record c. On the Select Record Format page, ensure that By delimiter symbol is
selected and then click Next.
d. On the Delimited Record page, set the Child delimiter to the pipe ( | ) symbol,
then select the Record has a tag identifier check box, then type BOOK in the
Tag box, and then click Next.
e. On the Child Elements page, change the Child nodes as listed in the table
below, and then click Next.
Element Name Element Type
ISBN Field element
Title Field element
Qty Field element
Price Field element
f. Click Finish.
10. Validate the Note: Validating the schema generates an XML translation of the message instance.
message instance. a. In Solution Explorer, right-click FFOrder.xsd, and then click Validate
Instance.
b. In the Output window, CTRL + click the Validation generated XML output
link. (If an Internet Explorer dialog appears, click OK to close the dialog)
Note: Notice that the data from FFOrder.txt has been translated from the flat file
format to XML.

Page 3 of 9
BizTalk Server 2006 R2: Processing Flat Files

Exercise 2
Create a Receive Pipeline to Disassemble a Message
Interchange
Scenario
In this exercise, you will create a new pipeline with a Flat file disassembler component. You will configure the
disassembler to process messages that match the type of the schema you created in the previous exercise. You will
then build and deploy the project.
Tasks Detailed Steps
Complete the following a. Right-click the RecoverableInterchange project, point to Add, and then click
tasks on: New Item.
b. In the Add New Item dialog box, click Pipeline Files, and then click Receive
Pipeline.
BizTalkServer2006R2VPC
c. In the Name text box, type ReceiveCustOrders.btp, and then click Add.

1. Create the pipeline


used to process
incoming flat file
messages.
2. Add a flat file Note: The flat file disassembler component uses the schema you defined to translate
disassembler to the incoming messages to XML.
pipeline. a. In the Pipeline Designer, drag and drop a Flat file disassembler pipeline
component from the Toolbox to the Disassemble stage of the pipeline.
b. In the Properties window for the Flat file disassembler component, set the
Document schema property to RecoverableInterchange.FFOrder.
Note: This schema is the same as the schema created by the Flat File Schema
Wizard. It has been provided here in case a mistake was made during the previous
exercise.
3. Build and deploy a. Click File, then Save All and Close Microsoft Visual Studio.
the b. Click Start and then Run. Type in cmd and click OK.
RecoverableInterc c. In the command prompt, type in cd c:\labs and press Enter.
hange project.
d. Type in del *.btproj.user /S and press Enter.
e. Leave the command prompt open in the background.
f. Open C:\Labs\Work\LabA\LabA.sln again.
g. In Windows explorer, copy C:\Labs\WhatsNEW.snk to the C:\Labs\common
folder (This step is necessary to ensure the solution will build properly)
h. Right-click the RecoverableInterchange project, and then click Build.
i. Right-click the RecoverableInterchange project, and then click Deploy.

Page 4 of 9
BizTalk Server 2006 R2: Processing Flat Files

Exercise 3
Enable and Test the Pipeline
Scenario
In this exercise, you will configure the receive location to process incoming messages through the
ReceiveCustOrders pipeline that you just built. After you’ve configured the receive location, you will start the
application, and process the test message. The message will be translated from the flat file format to XML.
Tasks Detailed Steps
Complete the following Note: A great deal of functionality has been added to the BizTalk Administration
tasks on: Console including the ability to change ports and receive locations.
The ReceiveCustOrders pipeline has already been deployed for this lab, and its
functionality is the same as the one created in Exercise 2.
BizTalkServer2006R2VPC
a. On the Start menu, point to All Programs, then point to Microsoft BizTalk
Server 2006, and then click BizTalk Server Administration.
1. Configure the b. In BizTalk Server 2006 Administration Console, expand BizTalk Server 2006
receive location to Administration > BizTalk Group > Applications > LabA.
use the c. Click Receive Locations, and then double-click RcvFFOrder in the right pane.
ReceiveCustOrder
pipeline. d. In the RcvFFOrder – Receive Location Properties window, choose
ReceiveCustOrders from the Receive pipeline list.
e. Under Type, click Configure….
f. Change the Receive folder to C:\Labs\Work\LabA\Messages\IN\ and click
OK.
g. Click OK.
h. Click Send Ports, and then double-click SendOrder in the right pane.
i. In the SendOrder – Send Port Properties window, click Configure….
j. In the FILE Transport Properties window, change the Destination folder to
C:\Labs\Work\LabA\Messages\OUT\ and click OK.
k. Click OK.
2. Start the Note: New to BizTalk Server 2006 is the application concept. An application is a
application. logical collection of run-time BizTalk artifacts.
a. In BizTalk Server 2006 Administration Console, right-click the LabA
application, and then click Start.
b. In the Start ‘LabA’ Application dialog box, click Start.
Note: The application concept is new to BizTalk Server 2006. Starting the application
starts and/or enables all ports, locations, and orchestration within the applications.
3. Test the processing Note: When processed through the pipeline the flat file message is transformed to
of the flat file XML.
message. a. In Windows Explorer, navigate to C:\Labs\Work\LabA\Messages.
b. Copy OrderFF.txt to the IN folder.
Note: Do NOT move the message to the IN folder. The message is unrecoverable
once BizTalk has processed it. If you do accidentally move the message, another
message can be found in C:\Labs\Work\LabA\Sample Messages.
c. When the message is removed from the IN folder, browse to the
C:\Labs\Work\LabA\Messages\OUT folder.
d. Open the {GUID}.xml message.
Note: Notice that the message has been transformed to an XML format.

Page 5 of 9
BizTalk Server 2006 R2: Processing Flat Files
Tasks Detailed Steps
e. Close and delete the {GUID}.xml message.

Page 6 of 9
BizTalk Server 2006 R2: Processing Flat Files

Exercise 4
Configure and Test the Pipeline for Interchange Processing
Scenario
In this exercise, you will add a header schema to the Flat file disassembler component of the pipeline to enable the
processing of batched messages. With BizTalk 2006 this process will not require redeploying the assembly, as
would have been required in 2004.
Tasks Detailed Steps
Complete the following a. Navigate to C:\Labs\Works\LabA\Messages, and then open BatchFF.txt.
tasks on: Note: Notice that the first line contains batch details, including the fact that this
message is indeed a BATCH, the company name, and a batch number. You should be
able to identify three individual messages (based on the FF schema generated in
BizTalkServer2006R2VPC Exercise 1) as the remainder of the message.
b. Close Notepad.
1. View the batch
message to be
disassembled.
2. Modify the Flat file Note: The header schema identifies information about the batched message.
disassembler a. In the BizTalk Server 2006 Administration Console, under LabA, click Receive
component in the Locations, and then double-click RcvFFOrder in the right pane.
pipeline to enable b. In the RcvFFOrder – Receive Location Properties window, click the Ellipsis
the processing of (…) button to the right of the Receive Pipeline list.
batched messages.
c. Set the HeaderSpecName property to RecoverableInterchange.Header, and
then click OK. (Note that you cannot select OK until you move the cursor
outside of the property box)
Note: The Header schema has been provided for you. It contains batch specific
information. A header schema is required to process batched messages.
The ability to configure pipeline properties without having to redeploy the assembly
is a new feature of BizTalk Server 2006.
d. In the RcvFFOrder – Receive Location Properties window, click OK.
3. Test the processing Note: When processed through the pipeline the batched message is split into three
of a flat file batch. separate XML messages.
a. Copy C:\Labs\Work\LabA\Messages\BatchFF.txt to the
C:\Labs\Work\LabA\Messages\IN folder.
Note: Do NOT move the message to the IN folder. The message is unrecoverable
once BizTalk has processed it. If you do accidentally move the message another
message can be found in C:\Labs\Work\LabA\Sample Messages.
b. Browse to the C:\Labs\Work\LabA\Messages\OUT folder and open the three
{GUID}.xml messages.
Note: There are now three messages - one for each order.
c. Close and delete all the messages in the OUT folder.

Page 7 of 9
BizTalk Server 2006 R2: Processing Flat Files

Exercise 5
Configure and Test the Pipeline for Recoverable
Interchange Processing
Scenario
In this exercise, you will try to process a batched message which contains bad data. You will see that without
recoverable interchange processing a batched message will fail as a whole. You will then configure the pipeline
during run time to allow recoverable interchange processing and submit the message again.

Tasks Detailed Steps


Complete the following Note: The BADDATA contained in a single message of the batch will cause a failure of
tasks on: all the messages.
a. In Windows Explorer, browse to C:\Labs\Work\LabA\Messages.
b. Open BadBatchFF.txt.
BizTalkServer2006R2VPC
Note: Notice that the sixth line of the message (within the second of the batched
messages) contains some “BADDATA”.
1. Submit a batched c. Close BadBatchFF.txt.
message that
d. Copy BadBatchFF.txt to the IN folder.
contains invalid
data. e. Browse to the OUT folder and verify that no new messages appear.

2. Diagnose the a. In BizTalk Server 2006 Administration Console, expand Event Viewer, and
problem. then click Application.
b. Double-click the error with the Event ID of 5719.
Note: In the Description section notice the line: “Reason: Unrecognized data in
remaining stream.” This is caused by the bad data in the message.
c. Close the Event Properties window.
3. Configure the Note: The recoverable interchange option is new to BizTalk Server 2006. It allows
pipeline to allow the processing of valid messages within an interchange even if one or more of the
recoverable messages are invalid. This means if a message batch contains 100 messages and 1 is
interchange invalid, the 99 good messages will be processed.
processing. a. In BizTalk Server 2006 Administration Console, under the LabA application,
click Receive Locations.
b. In the right pane, double-click RcvFFOrder.
c. In the RcvFFOrder – Receive Location Properties window, click the Ellipsis
(…) button.
d. In the Configure Pipeline dialog box, change the
RecoverableInterchangeProcessing property to True.
e. Click OK.
f. In the RcvFFOrder – Receive Location Properties window, click OK.
4. Process the batched a. In Windows Explorer, browse to C:\Labs\Work\LabA\Messages.
message that b. Copy BadBatchFF.txt to the IN folder.
contains bad data. c. Browse to the OUT folder.
Note: The two valid messages were processed correctly.
d. Close all open windows.

Page 8 of 9

You might also like