Mohsin Kalam’s Blog

November 14, 2007

XML Tools

Filed under: R2 EDI — Mohsin Kalam @ 3:25 pm

Goal:

To describe the design time experience in BizTalk R2 EDI.

Overview:

XML Tools extension hosted in Visual Studio is used to provide design time support to users to improve usability of EDI Schemas and also assist in the validation and generation of BTS EDI artifacts. The 3 main functions are “Validate Schema“, “Validate Instance” and “Generate Instance“.

To perform these 3 functions, a user needs to follow series of steps as follows:

  1. Set up Visual Studio with an EDI schema
  2. Set input/output properties on the schema (if applicable)
  3. Execute the operation (set delimiters if applicable)
  4. Observe the result

Let’s explain these plumbing steps in some details before going into the meat of this feature

Visual Studio Setup:

For all 3 operations, you would need to add an EDI schema in a BizTalk project in Visual Studio. This is what I refer to as the Base Schema as this would be used to set input/output properties and to execute the 3 operations. Here’s how you would do it:

  1. Open Visual Studio from the start menu. You can also type devenv at the run command box
  2. Go to File -> New -> Project
  3. In the dialog box that appears select “BizTalk Project” under project types and “Empty BizTalk Server Project” under Templates and click OK.
  4. You should now have a blank BizTalk project. Right click on the project and select Add -> Existing Item. Browse to the path where you have the EDI schema stored and add that!

Input/Output Properties: 

With the schema added you would have to set some properties on it for instance validation and generation. Right clicking on the schema and selecting “Properties” brings up the properties window where the users can select the following options:

Output Instance Filename:

Used to specify the path to where the output instance will be saved will respect to the “Generate Instance” property

Input Instance Filename:

Used to specify the path to where the input instance used with respect to the “Validate Instance” is located

Generate Instance Output Type:

A drop down used to specify the type of file to be generated. Two options are Native (EDI) and XML

Validate Instance Input Type:

A drop down used to specify the type of file to be validated. Two options are Native (EDI) and XML

Note: R2 ships with 8K+ schemas and any of these schemas can be used out of box within Visual Studio!

Delimiter Dialog Box:

During Validate Instance and Generate Instance, the users are presented with a dialog box to input the delimiters used for the respective operation. The dialog box for X12 is as follows (EDIFACT has a similar dialog box):

X12 Delimiter Dialog Box

This dialog box lets the user choose all the applicable separators along with the segment separator suffix, the encoding information and trailing delimiters option. The box also has a Error/Information section that is used to show validation errors to the user.

Now that we have touched on the back ground information for the core operations, lets dive into the core operations which as previously mentioned are Validate Schema, Validate Instance and Generate Instance. These operations are available by right clicking the schema added in a BizTalk Project.

Validate Schema:

This verifies that the schema is syntactically correct and it conforms to the EDI parsing rules and it can be used with the EDI pipeline components without parsing errors. Validate Schema requires no input and output parameters and does not require any delimiter dialog box.

Validate Instance:

This is used to validate an existing EDI instance with an EDI schema. Validate instance supports 2 modes of operation, namely Trasaction Set mode (TS) or Interchange mode.

TS mode:

In this mode, the input file is just a transaction set without the Interchange and group headers and trailer. For X12 this is a document with just ST and SE and for EDIFACT it is with just UNH and UNT. The base schema is the transaction set schema itself. Since the instance does not have the information for delimiters, the dialog box is popped for the user to input his selection. Once the user has input his selection, that setting is used to validate the input file against the base schema. Any validation error results in an error being logged in the output window. If there are no errors then a success message is logged in the output window. 

Both Native and XML formats are supported for TS mode.

Interchange mode:

In this mode, the input file is an Interchange containing one or more transaction sets in one or more groups. For X12 this is a document with ISA and IEA and for EDIFACT it is with UNB and UNZ. The base schemas for X12 and EDIFACT are X12_BatchSchema.xsd and Edifact_BatchSchema.xsd respectively. This is under {Microsoft BizTalk Server 2006}\X12_Schema\EDI. The user needs to add all the additional schemas that correspond to the transaction sets in the input file. For example if the input file has 810 and 850 transaction sets, the user needs to add X12_BatchSchema.xsd (the base schema) and 810 and 850 in the same project.

For X12, the delimiter information is already present in the file so that information is blanked out in the dialog box that pops up during interchange mode instance validation. For EDIFACT, if the optional UNA segment is present in the instance, then all the delimiter information is already present and that information is blanked out. Once the user has input his selection, that setting is used to validate the input file against the base schema and all the additional schemas. Any validation error results in an error being logged in the output window. If there are no errors then a success message is logged in the output window.

Only the Native format is supported for Interchange mode.

Generate Instance:

This is used to generate an EDI instance against an EDI schema. Like Validate Instance, Generate Instance also supports the 2 modes of operation.

TS mode:

In this mode, the output file is just a transaction set without the Interchange and group headers and trailer. For X12 this is a document with just ST and SE and for EDIFACT it is with just UNH and UNT. The base schema is the transaction set schema itself. During Generate Instance, the dialog box is popped for the user to input his selection. Once the user has input his selection, that setting is used to generate the utput file against the base schema. Any validation error results in an error being logged in the output window. If there are no errors then a success message is logged in the output window. 

Both Native and XML formats are supported for TS mode.

Interchange mode:

In this mode, the output file is an Interchange containing one or more transaction sets in one of more groups. For X12 this is document with ISA and IEA and for EDIFACT it is with UNB and UNZ. The base schemas for X12 and EDIFACT are X12_BatchSchema.xsd and Edifact_BatchSchema.xsd respectively. For every additional schema added in the BizTalk project, the output file will contain 3 transaction sets. For example if the BizTalk project contains the base schema and 810 and 850 schema, the output file will contain 2 groups each with 3 810 and 850s. For EDIFACT since the group is optional, the output file will not contain a group.

For both X12 and EDIFACT, the delimiter information is required to generate the instance. Once the user has input his selection in the delimiter box, that set of delimiter and the additional settings are used to generate the instance. Any validation error results in an error being logged in the output window. If there are no errors then a success message is logged in the output window.

Only the Native format is supported for Interchange mode.

Custom Schema View:

To make the XSD schema more readable and user friendly, XML Tools introduce the EDI schema view. This view highlights information like min length, max length, min occurs, max occurs etc about the individual nodes in the schema.

End Note:

I hope this post has been useful in understanding the Design Time Experience in BizTalk R2 EDI. Your comments/questions are always welcome.

Thanks

Mohsin Kalam

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: