Search
Windows Server

BizTalk 2010 Recipes : Referencing Schemas

Published 2 min readBy Programming4us Editorial Team

1. Problem

You would like to reference an XML schema in your BizTalk project, because you want to reuse an existing BizTalk artifact or prebuilt schema component.

2. Solution

As an example, assume you have a simple Customer XML schema (CustomerSchema.dll) stored in an existing BizTalk project:

<Customer>
<FirstName> </FirstName>
<LastName> </LastName>
<MiddleInit> </MiddleInit>
<Age></Age>

</Customer>

To reference an existing schema, follow these steps:

  1. Open your source project.

  2. Within the Solution Explorer, right-click the References tree node, and select Add Reference.

  3. Select the Projects tab in the Add References dialog box if the schema you are after is in the same project, or click the Browse tab, navigate to CustomerSchema.dll, and then click the OK button.

You now have referenced CustomerSchema.dll and can use the inherent BizTalk artifacts in your current project. For example, suppose that you want to use the DLL in a new map within your current project. Follow these steps:

  1. Right-click the project, and select Add => New Item.

  2. In the Add New Item dialog box, double-click Map. This opens a blank map with left and right panes where you can enter the source and destination schema, respectively.

  3. Click Open Source Schema in the left pane.

  4. In the BizTalk Type Picker dialog box, select the References tree node, and select the Client Schema reference.

  5. Select the Schemas node.

  6. Select the Customer schema.

3. How It Works

Referencing schemas gives you the ability to reuse and reference existing BizTalk artifacts, as you would normally reference other .NET artifacts. While this can be powerful, you should always keep in mind partitioning and change scenarios. For example, if you were to reference an existing deployed artifact, to make changes to the referenced artifact, you would need to remove the referenced artifact in the dependent project.

NOTE

One of the most important things you can do is plan how to organize your BizTalk artifacts into separate projects (and, in turn, assemblies). Intelligent namespacing is the first step, separating schemas into appropriate projects is the next. Since schemas are referenced by maps and by orchestrations, the map and orchestration artifacts often should be kept in their own, separate projects. Using small assemblies that have just a few artifacts is the ideal approach, as these are far more easy to update and redeploy than other methods of organization.

This example explored how to reference a schema artifact in another project. BizTalk also gives you the ability to reference schemas in Schema Import tasks.