Processing Flat Files

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Processing Flat Files as PDF for free.

More details

  • Words: 3,105
  • Pages: 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

Scenario

Estimated Time to Complete This Lab

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

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.

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 tasks on:

a.

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

BizTalkServer2006R2VPC

1.

Log on to the lab machine

2.

Investigate the records contained in the document for which you will be generating the schema.

a. In Windows Explorer, navigate to and open C:\Labs\Work\LabA\Messages\OrderFF.txt. Note: Notice that the first line contains PO details, including the fact that this message is indeed a Purchase Order, the customer name, the PO number, and the PO date. The second line consists of the address of the customer in a standard US format 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 Server 2006 Solution.

a. In Windows Explorer, browse to C:\Labs\Work\LabA, and then double-click LabA.sln to open the solution.

4.

Add a flat file schema to the project.

a. In Solution Explorer, right-click the RecoverableInterchange project, point to Add, and then click New Item. 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 structure using the Flat File Schema Wizard.

Note: The Flat File Schema Wizard provides an intelligent user interface for building flat file schemas. Everything that can be done using the Flat File Schema Wizard can be done using the BizTalk Editor. 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

6.

7.

Define the PODetail record.

Define the Address record.

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

Note: The PODetail record is comma delimited. 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

Note: The Address node is a positional 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

8.

9.

Define the Books record

Define the elements for the Book record

Detailed Steps Field element

State

Field element

Postal

Field element

Note: The Book node will be repeated for any orders with more than one book. This 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

a. On the Schema View page, ensure that Book 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 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.

f. 10. Validate the message instance.

City

Element Name

Element Type

ISBN

Field element

Title

Field element

Qty

Field element

Price

Field element

Click Finish.

Note: Validating the schema generates an XML translation of the 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 tasks on:

a. Right-click the RecoverableInterchange project, point to Add, and then click 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 disassembler to the pipeline.

Note: The flat file disassembler component uses the schema you defined to translate incoming messages to XML. 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 the RecoverableInterc hange project.

a. b. c. d. e. f. g.

Click File, then Save All and Close Microsoft Visual Studio. Click Start and then Run. Type in cmd and click OK. In the command prompt, type in cd c:\labs and press Enter. Type in del *.btproj.user /S and press Enter. Leave the command prompt open in the background. Open C:\Labs\Work\LabA\LabA.sln again. 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 tasks on:

Note: A great deal of functionality has been added to the BizTalk Administration 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. a. On the Start menu, point to All Programs, then point to Microsoft BizTalk Server 2006, and then click BizTalk Server Administration. b. In BizTalk Server 2006 Administration Console, expand BizTalk Server 2006 Administration > BizTalk Group > Applications > LabA. c. Click Receive Locations, and then double-click RcvFFOrder in the right pane. 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.

BizTalkServer2006R2VPC

1.

Configure the receive location to use the ReceiveCustOrder pipeline.

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 application.

Note: New to BizTalk Server 2006 is the application concept. An application is a 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 of the flat file message.

Note: When processed through the pipeline the flat file message is transformed to XML. 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 tasks on:

a. Navigate to C:\Labs\Works\LabA\Messages, and then open BatchFF.txt. 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 Exercise 1) as the remainder of the message. b. Close Notepad.

BizTalkServer2006R2VPC

1.

View the batch message to be disassembled.

2.

Modify the Flat file disassembler component in the pipeline to enable the processing of batched messages.

Note: The header schema identifies information about the batched message. a. In the BizTalk Server 2006 Administration Console, under LabA, click Receive Locations, and then double-click RcvFFOrder in the right pane. b. In the RcvFFOrder – Receive Location Properties window, click the Ellipsis (…) button to the right of the Receive Pipeline list. 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 of a flat file batch.

Note: When processed through the pipeline the batched message is split into three 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 tasks on:

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

BizTalkServer2006R2VPC

1.

Submit a batched message that contains invalid data.

2.

Diagnose the problem.

a. In BizTalk Server 2006 Administration Console, expand Event Viewer, and 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 pipeline to allow recoverable interchange processing.

Note: The recoverable interchange option is new to BizTalk Server 2006. It allows the processing of valid messages within an interchange even if one or more of the messages are invalid. This means if a message batch contains 100 messages and 1 is invalid, the 99 good messages will be processed. 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 message that contains bad data.

a.

In Windows Explorer, browse to C:\Labs\Work\LabA\Messages. b. Copy BadBatchFF.txt to the IN folder. c. Browse to the OUT folder. Note: The two valid messages were processed correctly. d. Close all open windows.

Page 8 of 9

Related Documents

Processing Flat Files
November 2019 5
Flat
November 2019 32
Processing
May 2020 35
Processing
June 2020 33
Files
November 2019 41