Validating and Generating an EDI Instance Message in Visual Studio

(Posted on behalf of mstern)

BizTalk 2006 R2 EDI comes with a large number of standard EDI schemas which are in a self-extracting archive:

\Microsoft BizTalk Server 2006\XSD_Schema\EDIMicrosoftEdiXSDTemplates.exe

Once you extract these, you will have more than 8,000 standard schemas.

See the R2 EDI Product team blog for an overview of the available schemas.

Validating an instance

Not all fields of an EDIFACT/X12 message are defined in the XSD schema.

For EDIFACT, the UNB fields are set in the pipeline, for X12 the ISA field.

Thus, in Visual Studio you cannot test a full EDI message directly against a schema, as you would expect from non-EDI messages

For this purpose R2 provides Batch Schemas to test a message against an EDI schema in Visual Studio. The batch schemas are in \Microsoft BizTalk Server 2006\XSD_Schema\EDI

There are two batch schemas:

For EDIFACT: Edifact_BatchSchema.xsd

For X12: X12_BatchSchema.xsd


EDI consist of two related standards, which use common base technologies but are in fact quite different.

a) The X12 series of standards (from ANSI, the American National Standards Institute). X12 is used mainly in the USA.,

b)The EDIFACT series of standards (from the United Nations) . EDIFACT is used in the rest of the world.

To test a schema, add the EDI schema (e.g. the EDIFACT invoice schema EFACT_D96A_INVOIC.xsd) and the batch schema (Edifact_BatchSchema.xsd) to your Visual Studio project.

(Adding the batch schema is only needed during design time.)

Set the input and output filename in the properties of the batching schema


To validate the input instance, use “Validate Instance” of the batching schema.

Note: if you run "validate instance" on the batch schema, each EDI schema included in the project will be tested. I

Generating an instance

To generate an instance of a EDIFACT/X12 message, again use the batching schemas.

Right-click the batching schema and choose “Generate Instance”. A dialog window will pop up, where you can set a number of semantic settings of the generated message. Take the default, and you will have your EDIFACT/X12 message.