Editar

Compartilhar via


Instance Message Generation and Validation

After you have validated a schema, you can use it to generate a sample instance message. The sample instance message that is generated contains the element and attribute structure specified by the schema, and generate fake data where required.

Note

The data-generation mechanism used when generating instance messages is not sufficiently sophisticated to generate data according to values specified for several properties. For example, if the schema contains any values for the Pattern property, which is available in the Restrictions category for Field Element nodes and Field Attribute nodes when their Derived By property is set to Restriction, the generated instance message cannot be used as is, as input to the Validate Instance operation.

To generate a sample instance message from a schema, use the Generate Instance command on the shortcut menu associated with the schema in Solution Explorer. The results of the instance message generation operation are reported in the Visual Studio Output window.

Note

The Generate Instance operation includes the Validate Schema operation. If validation fails, no sample instance message will be generated.

For detailed step-by-step instructions regarding how to generate an instance message from a schema, including how to configure an output file to contain the generated instance message, see Generating Instance Messages.

Note

If you do not specify a value for the Root Reference property of the Schema node, BizTalk Editor generates an instance message for the first root node in the schema. If you specify a value for the Root Reference property, BizTalk Editor generates an instance message for the specified root.

If you have validated your schema, you can use BizTalk Editor to determine whether an instance message conforms to that schema.

To validate an instance message against a schema, use the Validate Instance command on the shortcut menu associated with the schema in Solution Explorer. The results of the validation are reported in the Visual Studio Output window.

Note

There are cases in which a generated instance message will not pass validation against the same schema from which it was generated. For example, if you attempt to validate an instance message that was generated by using the Generate Instance command in BizTalk Editor, and the relevant schema includes any Field Element nodes or Field Attribute nodes that have their Derived By property set to Restriction and which use the Pattern property to specify a pattern to which the corresponding data must conform, the validation will fail. This is because the data-generation mechanism used when generating instance messages is not sufficiently sophisticated to generate data according to values specified for the Pattern property. Other cases also exist.

For detailed step-by-step instructions regarding how to validate an instance message, including how to specify the instance message to be validated, see Validating Schemas.

See Also

About Schemas
Testing Schemas