Microsoft BizTalk Server 2004: Creating Schemas

In this tutorial from Microsoft Virtual Labs, you will learn how to use the BizTalk Schema Editor. You will start by creating a new BizTalk project. When you have finished, you will have created a custom schema for a sample company to meet requirements for submitting orders to a supplier.

Contributed by
Rating: 4 stars4 stars4 stars4 stars4 stars / 11
February 16, 2006
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Objectives

After completing this lab, you will be able to:

  • Create a new BizTalk project.
  • Create an XML schema by using BizTalk Schema Editor.
  • Promote a schema property.
  • Create a file schema by using BizTalk Schema Editor.
  • Validate a schema and generate a sample instance message.
  • 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 orchestration that you will create in later labs.

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

Estimated time to complete this lab: 45 minutes

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

Exercise 1 Creating a New BizTalk Project

Scenario

In this exercise, you will build a new solution for this project by using the Visual Studio .NET 2003 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              Detailed steps

  1. Set up lab.

      1. Click inside the virtual machine window. 
      2. Press Right-ALT + DEL.
      3. Type a password of pass@word1 and press Enter.
      4. Use Windows Explorer to navigate to and run C:\Labs\Setup Scripts\SetupLab2.A.bat.

        This script will erase the existing projects and artifacts in the C:\Labs\Work folder and copy all required artifacts and files for this lab into the C:\Labs\Work folder.

      5. Close Windows Explorer.
  2. Create a blank solution.

    A solution may include only one BizTalk project, if the solution is relatively simple.

    A solution may include many BizTalk projects, if the solution consists of numerous projects that are developed independently and then must be integrated later.

      1. Click Start, point to All Programs, point to Microsoft Visual Studio .NET 2003, and then click Microsoft Visual Studio .NET 2003.

        The Visual Studio .NET 2003 splash screen appears, and then Visual Studio .NET starts.

      2. Click File | New | Blank Solution.
      3. In the New Project dialog box, select the Blank Solution template. 
      4. In the Name field, type NWBusinessSolution as the solution name.
      5. In the Location field, type C:\Labs\Work
         

      6. Click OK to open the new solution.
  3. Add a new BizTalk project to the solution.

    Selecting the BizTalk project template exposes the BizTalk tools, such as BizTalk Mapper, within the Visual Studio .NET development environment, and invokes a BizTalk-specific compiler.

      1. In Solution Explorer, right-click Solution 'NWBusinessSolution', point to Add, and then select New Project.
      2. In the Add New Project dialog box, select the BizTalk Projects folder. 
      3. In the Templates pane, select Empty BizTalk Server Project
      4. In the Name field, type NWMessaging as the project name.
         

      5. Click OK to open the new project.

        A new project is added to Solution Explorer, and the project folder is created in C:\Labs\Work\NWBusinesSolution.

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

Exercise 2 Creating an XML Schema using the 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.

        Tasks              Detailed steps

  1. Create the shipping address schema.

    Selecting the Schema template causes BizTalk Editor to start.

      1. In Solution Explorer, right-click the NWMessaging project, point to
        Add, and then select Add New Item
      2. In the Add New Item dialog box, in the Templates pane, select Schema
      3. In the Name box, type ShippingAddress.xsd to name the schema.
         

      4. Click Open to open the blank schema in BizTalk Editor. 
      5. View the Properties pane.

        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.

    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.

      1. In the Schema Tree, right-click the Root node, and then select Rename.

      2. Type ShippingAddress as the new name, and then press Enter

      3. Right-click the ShippingAddress (root) node, point to Insert Schema Node, and then select Child Field Element to add the following fields (repeat this step for each field element):

        • City 

        • Country 

        • Street 

        • Email 

        • Fax 

        • State 

        • Zip

        • Phone

          The completed schema should look like this:



      4. Click File | Save All.

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

    This allows you open an existing schema and use the import function to insert schema nodes within an existing schema.

    You can show properties in alphabetic order by clicking the Alphabetic button at the top of the Properties window.

      1. In Solution Explorer, right-click the NWMessaging project, point to Add, and then select Add Existing Item
      2. Navigate to C:\Labs\Work, and then double-click the CustomerOrder.xsd schema to add it to the project.

        The schema is added to Solution Explorer.

      3. In Solution Explorer, double-click CustomerOrder.xsd to open it in BizTalk Editor.

        If the Properties window is not visible, then in BizTalk Editor right-click the <Schema> node of CustomerOrder.xsd, and then select Properties.

      4. In the Properties window, click the Imports property, and then click the ellipsis (…) button.
      5. In the Imports dialog box, verify that XSD Import is selected from the drop down box, and then click Add
      6. In the BizTalk Type Picker, expand Schemas, select NWMessaging.ShippingAddress, and then click OK
      7. In the Imports window, click OK
      8.  Right-click the CustomerOrder root node, select Insert Schema Node, and then click Child Record
      9. Right-click the child record Record and click Properties.
      10. In the Properties window, select the Data Structure Type property and, from the drop-down box, select ns1:ShippingAddress (Reference).
        The ShippingAddress record is added to the schema. 

      11. Click File | Save All.

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

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              Detailed steps

  1. Promote property fields.

    The property fields are promoted so that their values can be referenced for content based routing purposes and orchestration.

    The Property1 node in the PropertySchema.xsd is not used and can be deleted.

      1. In the BizTalk Editor, in the Schema Tree, right-click the <Schema> node, and then select Expand Schema Node to show the entire schema.
      2. Right-click the CustomerPONumber node, point to Promote, and then click Quick Promotion.
      3. Click OK to add the property schema to the project.

        The icon for the PO field has changed to indicate that the field has been promoted. Also, a new schema (PropertySchema.xsd) is added to the Solution Explorer.

      4. Right-click the TotalOrderAmount node, point to Promote, and then click Quick Promotion.
  2. Promote distinguished fields.

    The distinguished fields are promoted so that their values can be referenced in an orchestration that you will create in later labs.

      1. Right-click the <Schema> node, point to Promote, and then select Show Promotions.
      2. Select the following fields from the Schema (left) pane, and then add them as distinguished fields: 
        • Status
        • Comments
      3. Click OK.

        The completed schema should look as shown here 

         
      4. On the File menu, click Save All to save your work.

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

Exercise 4 Creating a Flat File Schema using the BizTalk Editor

Scenario

In this exercise, you will create a flat file schema to define the structure of a customer contact record.

        Tasks              Detailed steps

  1. Create the customer contact schema.

    This creates the XSD schema that describes the XML structure that flat files will be converted to.

      1. In Solution Explorer, right-click the NWMessaging project, point to Add, and then select Add New Item
      2. In the Add New Item dialog box, in the Templates pane, select Schema; and then, in the Name box, type CustomerOrderFlatFile.xsd and click Open
      3. In BizTalk Editor, right-click the <Root > node, and then rename the schema to Customers
      4. Right-click the Customers node, select Insert Schema Node, and then select Child Record.
      5. Rename the child record to Customer
      6. Add the following Child Field Elements

        • FirstName 
        • MiddleName
        • LastName 
        • ContactNo
  2. Configure the schema as a flat file schema.

    This creates properties for the schema node that map to XSD schema annotations.

    You will use a child delimiter that specifies a carriage return (0D) and a line feed (0A).

      1. Right-click the <Schema> node, and then select Properties.
      2. In the Properties window, click the Schema Editor Extensions property, and then click the ellipsis (…) button. 
      3. In the Schema Editor Extensions window, select the Flat File Extension checkbox, and then click OK
      4. Right-click Customers and click Properties 
      5. In the Properties window, set the following properties:

        Property

        Value

        Child Delimiter

        0x0D 0x0A

        Child Delimiter Type

        Hexadecimal

        Child Order

        Postfix


      6. Right-click Customer and click Properties.
      7. In the Properties window, set the following properties:

Property

Value

Child Delimiter

,

Child Delimiter Type

Character

Child Order

Infix

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

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              Detailed steps

  1. Validate the schema file.

    Validating the schema insures that an XML document could be created that would be well-formed and valid against this particular schema.

      1. In Solution Explorer, right-click CustomerOrder.xsd, and then select Validate Schema.

        The results of the schema validation are displayed in the output window.

  2. Generate a sample instance message for the schemas.

    Generating a sample instance provides a visual test, as well as a document to pass through the process for testing.

      1. Right-click the CustomerOrder.xsd, and then select Properties.
      2. In the CustomerOrder.xsd Property Pages dialog box, in the Output Instance Filename box, type C:\Labs\Work\GeneratedCustomer Order.xml and then click OK.
      3. Right-click the CustomerOrder.xsd schema, and then select Generate Instance.

        A sample instance message is saved in C:\Labs\Work, and a link to the XML instance is shown in the Output window. Click the link while pressing Ctrl to open the resulting XML file.

  3. Validate the sample instance message.

    The CustomerOrder.xml XML file is provided so that you can check for errors in the schema you just created.

      1. Right-click the CustomerOrder.xsd schema, and then select Properties
      2. In the CustomerOrder.xsd Property Pages dialog box, in the Input Instance Filename box, type C:\Labs\Work\CustomerOrder.xml and then click OK
      3. Right-click the CustomerOrder.xsd schema file, and then select Validate Instance.

        The results of the instance validation are displayed in the output window. This step validates the schema against an actual XML file.

  4. Validate the flat file sample instance.

    The CustomerOrder.txt flat file is provided so that you can check for errors in the schema you just created.

      1. a. Right-click CustomerOrderFlatFile.xsd, and then select Properties.
      2. In the CustomerOrderFlatFile.xsd Property Pages dialog box, set the following properties: 

         

         

        Property

        Value

         

        Input Instance Filename

        C:\Labs\Work\CustomerOrder.txt

         

        Validate Instance Input Type

        Native

         

         


      3. Click OK.
      4. Right-click the CustomerOrderFlatFile.xsd schema file, and then select Validate Instance.

        The results of the instance validation are displayed in the output window. This step validates the schema against an actual flat file.

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

Exercise 6 Assigning a Strong Name to the Assemblies

 

Scenario

In this exercise, you will create and assign a strong name for the BizTalk assemblies you are about to build. A strong-named assembly provides several security benefits. A strong name guarantees the uniqueness of the assembly by assigning a digital signature and a unique key pair. This also protects the lineage of the assembly by ensuring that no one else can generate a subsequent version of that assembly. And finally, a strong name provides a strong integrity check to guarantee that the contents of the assembly have not been changed since it was built.

        Tasks              Detailed steps

  1. Create a strong name assembly key file.

    This creates a strong name public/private key pair, which is saved to an assembly key file.

      1. Click Start | Programs | Microsoft Visual Studio .NET 2003 | Visual Studio .NET Tools | Visual Studio .NET 2003 Command Prompt.

        The Visual Studio .NET command prompt appears. 

      2. At the command prompt, type cd C:\Labs\Work and then press ENTER
      3. Type sn -k Key.snk and then press ENTER.

        A message appears, indicating that the key pair has been written to the key file (Key.snk). 
      4. Type Exit to close the Command Prompt.
  2. Assign a strong name to the assembly.

    This assigns the key file to the assembly. You must do this for each of the projects in this solution.

      1. In Solution Explorer, right-click the NWMessaging project, and then select Properties
      2. In the left pane of the NWMessaging Property Pages page, click Assembly.
      3. In the right pane, scroll down to the Strong name section, click the field to the right of Assembly Key File, and then click the ellipsis (…) button. 
      4. In the Assembly Key File dialog box, navigate to C:\Labs\Work\Key.snk, and then click Open.
         

      5. Click OK to save changes.

Exercise 7 Building the Schema Project

Scenario

In this exercise, you will build the project to generate an assembly that contains the resources (the schemas) that you have just created. This also ensures that that there are no compile-time errors in the work you have completed so far.

        Tasks              Detailed steps

  1. Build the project.

    The assembly is compiled into a DLL file and saved in the …\bin\Development folder within the project folder.

      1. On the File menu, click Save All.
      2. In Solution Explorer, right-click NWMessaging, and then select Build.

        The results of the compiled schema project are displayed in the output window. Do not deploy this assembly, because deployment could affect later labs. 
      3. Close Visual Studio.

Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual.
Try this lab out now.

blog comments powered by Disqus
BRAINDUMP ARTICLES

- Microsoft Windows 8 Committed to Cloud Compu...
- Independent Developers Favor Windows Phone 7
- Dell Introduces VMware-based Cloud
- Microsoft and Skype Agree to Acquisition Deal
- Transfer Contacts in Microsoft Outlook
- Zune`s Next Steps
- Safari Books Online Review
- Does Microsoft Get Touch Screens Now?
- Microsoft`s Record Quarterly Earnings Not En...
- Basic Operations and Registers in Assembly
- Assembly Coding within Visual C/C++ IDE
- New Microsoft Office Coming with a Twist
- Microsoft`s FUSE Labs Unveils Spindex Social...
- HP Slate with Windows 7: Dead or Alive?
- Windows Phone 7 Mobile OS to Rival Android a...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials