0% found this document useful (0 votes)
75 views16 pages

Microsoft Virtual Labs: Biztalk Server 2009: Working With Schemas

BizTalk Server 2009: Working with schemas. Create a New BizTalk Project and define a customer order schema. Promote several of the schema properties so that the property values can be referenced for content-based routing purposes. Generate a sample instance message and validate the schemas to check for any inconsistencies.

Uploaded by

birroz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views16 pages

Microsoft Virtual Labs: Biztalk Server 2009: Working With Schemas

BizTalk Server 2009: Working with schemas. Create a New BizTalk Project and define a customer order schema. Promote several of the schema properties so that the property values can be referenced for content-based routing purposes. Generate a sample instance message and validate the schemas to check for any inconsistencies.

Uploaded by

birroz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Microsoft Virtual Labs

BizTalk Server 2009: Working with Schemas

BizTalk Server 2009: Working with Schemas

Table of Contents
BizTalk Server 2009: Working with Schemas............................................................................ 1
Exercise 1 Creating a New BizTalk Project ..................................................................................................................2 Exercise 2 Creating an XML Schema Using BizTalk Editor ........................................................................................3 Exercise 3 Promoting Schema Properties ......................................................................................................................6 Exercise 4 Creating a Flat File Schema using The Flat File Schema Wizard ................................................................8 Exercise 5 Validating Schemas and Generating Instance Messages ........................................................................... 11 Exercise 6 Sign and Build the Project Output ............................................................................................................. 13

BizTalk Server 2009: Working with Schemas

BizTalk Server 2009: Working with Schemas


Objectives
After completing this lab, you will be able to: Create a new BizTalk project Create an XML schema by using the BizTalk Editor Promote a schema property Create a flat file schema by using the BizTalk Editor Validate a schema and generate a sample instance message Create a strong name and assign it to an assembly Build a schema project

Scenario

Northwind Traders has chosen to create a custom schema to meet their business requirements for submitting orders to a supplier. In this lab you will create a BizTalk project for the schema, and then define a customer order schema to define the structure of messages (documents) to be exchanged within the solution. You will also promote several of the schema properties so that the property values can be referenced for content-based routing purposes in the BizTalk Server messaging engine.

Prerequisites

After you have created the schemas and promoted the schema properties, you will use the BizTalk Editor to generate a sample instance message and validate the schemas to check for any inconsistencies.

Estimated Time to Complete This Lab Computers used in this Lab

45 Minutes

BTSHOLs

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

Page 1 of 14

BizTalk Server 2009: Working with Schemas

Exercise 1 Creating a New BizTalk Project


Scenario
In this exercise, you will build a new solution for this project by using the Microsoft Visual Studio 2008 environment. First you will create a new blank solution, and then you will add a new project to the solution. This project will contain the schemas that you will create in the following exercises.
Tasks Complete the following tasks on: BTSHOLs 1. Create a blank solution. Detailed Steps Note: A solution might include only one BizTalk project if the solution is relatively simple. A solution might include many BizTalk projects if the solution consists of numerous projects that are developed independently and then must be integrated later. a. Click Start, point to All Programs, point to Microsoft Visual Studio 2008, and then click Microsoft Visual Studio 2008. Note: The Visual Studio 2008 splash screen appears and then Visual Studio starts. In Visual Studio, from the File menu, click New, and then click Project. In the New Project dialog box, expand Other Project Types, click Visual Studio Solutions, and then click the Blank Solution template. In the Name box, type NWBusinessSolution as the solution name. In the Location box, type C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start. Click OK to open the new solution.

b. c. d. e. f.

Note: A new solution appears in Solution Explorer and the solution files are created in C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start\NWBusinessSolution. 2. Add a new BizTalk project to the solution. Note: Selecting the BizTalk project template exposes the BizTalk tools, such as BizTalk Mapper, within the Visual Studio .NET development environment, and invokes BizTalk-specific build tasks. a. b. c. In Solution Explorer, right-click Solution 'NWBusinessSolution', point to Add, and then click New Project. In the Add New Project dialog box, in the Project Types pane, click BizTalk Projects. In the Templates pane, select Empty BizTalk Server Project.

d. In the Name box, type NWMessaging, and then click OK. Note: A new project is added to Solution Explorer, and the starting project files are created in C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start\NWBusinesSolution\NWMessaging. e. In Solution Explorer, under NWMessaging, expand References to view the default references that get added to a new project.

Page 2 of 14

BizTalk Server 2009: Working with Schemas

Exercise 2 Creating an XML Schema Using BizTalk Editor


Scenario
In this exercise, you will create a schema to define the structure of the shipping address record. You will also open an existing schema and use the import function to insert schema nodes within the existing schema that use the newly created address defintion. Tasks Complete the following tasks on: BTSHOLs 1. Create the shipping address schema. Detailed Steps Note: Selecting the Schema template causes BizTalk Editor to start. a. b. c. In Solution Explorer, right-click the NWMessaging project, point to Add, and then click New Item. In the Add New Item dialog box, in the Categories pane, select Schema Files, and then in the Templates pane, select Schema. In the Name box, type ShippingAddress.xsd, to name the schema.

d. Click Add to open the blank schema in BizTalk Editor. Note: The schema tree (left pane) and XSD view (right pane) appear in BizTalk Editor. Also, the new schema (ShippingAddress.xsd) is added to Solution Explorer. 2. Create the schema record. Note: The Root node should always be renamed using a meaningful name that represents the type of document described by the schema. When possible, use a root node name unique throughout the enterprise. You can right-click an empty area of the Toolbar and select BizTalk Editor to display a floating toolbar of BizTalk Editor options. a. b. c. In the Schema Tree, right-click the Root node, and then click Rename. Type ShippingAddress as the new name, and then press ENTER. Right-click the ShippingAddress node, point to Insert Schema Node, and then click Child Field Element to add the following fields (repeat this step for each field element): City Country Street Email Fax State Page 3 of 14

BizTalk Server 2009: Working with Schemas Tasks Detailed Steps Zip Phone

Note: The completed schema should look like this:

d. 3. Open an existing schema and import a new child record.

On the File menu, click Save All.

Note: This allows you to open an existing schema and use the import function to insert schema nodes within an existing schema allowing you to reuse schema types. You can show properties in alphabetical order by clicking the Alphabetic button at the top of the Properties window. a. b. In Solution Explorer, right-click the NWMessaging project, point to Add, and then click Existing Item.

Browse to C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start, and then double-click the CustomerOrder.xsd schema to add it to the project. Note: The schema is added to Solution Explorer. c. d. e. f. g. In Solution Explorer, double-click CustomerOrder.xsd to open it in BizTalk Editor. If the Properties window is not visible, then in the BizTalk Editor, right-click the <Schema> node of CustomerOrder.xsd, and then select Properties. In the Properties window, click the Imports property, and then click the Ellipsis () button. In the Imports dialog box, verify that XSD Import is selected from the dropdown box, and then click Add. In the BizTalk Type Picker dialog box, expand NWMessaging, expand Schemas, click NwMessaging.ShippingAddress, and then click OK.

Page 4 of 14

BizTalk Server 2009: Working with Schemas Tasks Detailed Steps

h. i. j.

Click OK to close the Imports dialog box. Right-click the CustomerOrder root node, click Insert Schema Node, and then click Child Record.

Click the child record Record, then in the Properties window, select the Data Structure Type property, and from the list, select ns1:ShippingAddress (Reference). Note: The ShippingAddress record is added to the schema and includes all of the child elements you defined in the first exercise. k. On the File menu, click Save All.

Page 5 of 14

BizTalk Server 2009: Working with Schemas

Exercise 3 Promoting Schema Properties


Scenario
In this exercise, you will promote schema properties so that the property values can be referenced by BizTalk messaging and orchestration. Promotion is a mechanism that you must use when you want to reference a specific value within a message instance and then use the value to make message routing decisions. Additionally, the promoted property will be visible by IntelliSense in Expression Editor when code is required in an orchestration. Tasks Complete the following tasks on: BTSHOLs
1.

Detailed Steps a. In BizTalk Editor, in the Schema Tree, right-click the <Schema> node, and then click Expand Schema Node to show the entire schema. b. Under the Customer Order node, right-click CustomerPONumber, point to Promote, and then click Quick Promotion. c. When prompted, click OK to add the property schema to the project. Note: A new schema (PropertySchema.xsd) is added to the Solution Explorer and is opened in the BizTalk Editor. d. Close the PropertySchema.xsd file to return to editing the CustomerOrder.xsd file. Note: The icon for the CustomerPONumber has changed to indicate that the field has been promoted. e. Right-click TotalOrderAmount, point to Promote, and then click Quick Promotion. Note: The distinguished fields are promoted so that their values can be referenced in an orchestration that you will create in later labs. Distinguished fields cannot be used to make routing decisions. Right-click the <Schema> node, point to Promote, and then click Show Promotions. a. Select the following fields from the Schema (left) pane, and add them as distinguished fields by clicking the Add >> button to move them to the list of distinguished fields on the right side of the dialog: Status Comments

Promote property fields.

2.

Promote distinguished fields.

Page 6 of 14

BizTalk Server 2009: Working with Schemas Tasks Detailed Steps b. Click OK. Note: The completed schema should look like this: c. On the File menu, click Save All.

Page 7 of 14

BizTalk Server 2009: Working with Schemas

Exercise 4 Creating a Flat File Schema using The Flat File Schema Wizard
Scenario
In this exercise, you will create a flat file schema to define the structure of a customer contact record. Flat file schemas provide the translation between the flat file format, such as comma separated values (CSV) and XML. BizTalk uses these schemas to parse flat file documents into their related XML structure. Tasks Complete the following tasks on: BTSHOLs
1.

Detailed Steps Note: This creates the XSD schema that describes the XML structure that flat files will be converted to. The schema will contain metadata providing details on the flat file format including delimiters, wrap characters, field sizes, etc. a. In Solution Explorer, right-click the NWMessaging project, point to Add, and then click New Item. b. In the Add New Item dialog box, in the Templates pane, select Flat File Schema Wizard. c. In the Name box, type CustomerOrderFlatFile.xsd, and then click Add. d. In the BizTalk Flat File Schema Wizard, click Next. e. On the Flat File Schema Information page, in the Instance file box, browse to or type C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start\CustomerOrder.txt. f. In the Record name box, type Customers, and then click Next.

Create the customer contact schema.

g. h. i. j.

On the Select Document Data page, leave all the data selected, and then click Next. On the Select Record Format page, verify that By delimiter symbol is checked, and then click Next. On the Delimited Record page, set the Child Delimiter to {CR}{LF}, and then click Next. On the Child Elements page enter Customer for the Element Name of the

Page 8 of 14

BizTalk Server 2009: Working with Schemas Tasks Detailed Steps first item. k. Change the Element type of the first item to Repeating record. l. Change the Element type of the second item to Ignore.

m. Click Next to finish defining the root record. Note: You will be returned to the beginning of the wizard, this time to define the child record format. n. Select Next to begin defining the Customer record. o. On the Select Document Data page, ensure that only the first line of text is selected and click Next.

p. q. r.

On the Select Record Format page, verify that By delimiter symbol is checked, and then click Next. On the Delimited Record page, set the Child Delimiter to , (Comma), and then click Next. On the Child Elements page, change the Element Names to: FirstName Page 9 of 14

BizTalk Server 2009: Working with Schemas Tasks Detailed Steps MiddleName LastName ContactNo

s.

Click Next, and then click Finish to create the schema.

Page 10 of 14

BizTalk Server 2009: Working with Schemas

Exercise 5 Validating Schemas and Generating Instance Messages


Scenario
In this exercise, you will use the Validate Schema command to determine whether the schemas contain any internal inconsistencies, or have other issues that might prevent them from being used effectively for processing instance messages. You will also generate a sample instance message for each of the schemas.

Tasks Complete the following tasks on: BTSHOLs 1. Validate the schema file. 2. Generate a sample instance message for the schemas.

Detailed Steps Note: Validating the schema ensures that an XML document can be created that would be well-formed and valid against this particular schema. a. In Solution Explorer, right-click CustomerOrder.xsd, and then click Validate Schema. Note: The results of the schema validation are displayed in the output window. The schema validation tool is helpful when using schemas youve received from other parties or trading partners, that may not have been generated using BizTalk Server. BizTalk schemas will always validate. Note: Generating a sample instance provides a visual test as well as a document to pass through the process for testing. a. Select the CustomerOrder.xsd file in Solution Explorer b. In the Properties window, type C:\MSLabs\BizTalk Server 2009\Core Labs\Work\Lab 2\GeneratedCustomerOrder.xml in the Output Instance Filename box, and press ENTER. c. In Solution Explorer, right-click CustomerOrder.xsd, and then click Generate Instance. Note: A sample instance message is saved in C:\MSLabs\BizTalk Server 2009\Core Labs\Work\Lab 2\, and a link to the XML instance is shown in the Output window. d. Click the link while pressing CTRL to view the resulting XML file. Note: The CustomerOrder.xml XML file is provided so that you can check for errors in the schema you just created. a. In Solution Explorer, click CustomerOrder.xsd to highlight it. b. In the Properties window, type C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start\CustomerOrder.xml in the Input Instance Filename box, and then press ENTER. c. Right-click the CustomerOrder.xsd schema file, and then click Validate Instance. Note: The results of the instance validation are displayed in the output window. This step validates the schema against an actual XML file.

3. Validate the sample instance message.

4. Validate the flat file sample instance.

Note: The CustomerOrder.txt flat file is provided so that you can check for errors in the schema you just created a. In Solution Explorer, click CustomerOrderFlatFile.xsd to highlight it.

Property Page 11 of 14

Value

BizTalk Server 2009: Working with Schemas Tasks Detailed Steps Input Instance Filename C:\MSLabs\BizTalk Server 2009\Core Labs\Lab 2\Start\CustomerOrder.txt

Native Validate Instance Input Type b. In Properties window, verify the following properties: c. Right-click the CustomerOrderFlatFile.xsd schema file, and then click Validate Instance. Note: The results of the instance validation are displayed in the output window. This step validates the schema against an actual flat file. d. In the Output window, while holding CTRL click the top link (ends with output.xml). Note: The window that opens displays the xml that was generated by parsing the flat file. Notice that there are two customer elements, one for each line in the original file. e. Close the preview pane.

Page 12 of 14

BizTalk Server 2009: Working with Schemas

Exercise 6 Sign and Build the Project Output


Scenario
In this exercise, you will create and assign a strong name for the BizTalk assembly that you are about to build. A strongly-named assembly provides several security benefits and allows for side-by-side versioning of assemblies. A strong name guarantees the uniqueness of the assembly by assigning a digital signature and a unique key pair. Tasks Complete the following tasks on: BTSHOLs 1. Create a strong name assembly key file. Detailed Steps Note: This creates and assigns the key file to the assembly. You must do this for each of the projects in this solution. a. In Solution Explorer, right-click the NWMessaging project and select Properties. b. Select the signing tab to display the signing property page. c. Check the box labeled Sign the assembly. d. In the drop down box, select <New. . . > e. When prompted enter Key.snk for the Key file name and uncheck the box to protect the key file with a password.

f.

Choose Save all files from the File menu.

Page 13 of 14

BizTalk Server 2009: Working with Schemas Tasks


2.

Build the project.

Detailed Steps Note: The assembly is compiled into a DLL file and saved in the \\bin\Debug folder within the project folder. a. In Solution Explorer, right-click NWMessaging, and then click Build. Note: The results of the compiled schema project are displayed in the output window. b. Close Visual Studio.

Page 14 of 14

You might also like