Document Schemas
Important
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Document schemas in Application Integration Framework (AIF) are used to define the format of the data that is exchanged. The document schema contains all the fields that can participate in a data exchange using that document service.
The XML for each message in a data exchange contains the document itself and data about the exchange. The data exchange information includes the envelope, the header, and entity keys. This data is used by AIF to determine which service and action to call. All of the data in the XML is validated against the appropriate schema.
The following table describes the schemas that define the format and content of messages in AIF.
Schema |
Description |
---|---|
Message schemas |
Define the format and content of the message metadata. This includes elements such as the envelope, the header, query criteria, entity key lists, and so on. The message schemas are included with Microsoft Dynamics AX. For more information, see the section “Schemas” in Messages and transforms in AIF. |
Document schema |
Defines the format and content of the business data in a message. You can save the XSD for any document that has any port-specific customizations when you configure data policies for an integration port. For more information, see the “Customizing documents” section of Customize service contracts. |
For more information about the conventions used in document schemas, see Document Schema Rules.
For instructions and code that illustrates how to generate the schema for a document by using X++, see How to: Generate a Document Schema.
Schema Mapping
The document schema defines what data elements can participate in a data exchange and the rules for those elements. The document schema structure is based on the query that is associated with the document. The schema for the document is generated by iterating through the document query that defines the structure of the document. The schema uses the names of the Ax <Table> classes and their properties to name the XML elements. The document data is mapped directly from the query to the XML schema, but with the following exceptions:
Hidden fields, disabled fields, and data sources in the document query are excluded from the schema.
The name of the root element in the schema is derived from the Axd <Document> class name by removing the Axd prefix.
The document query can have only one root data source.
All properties that are associated with the Axd <Document> class are included in the schema. Document properties contain document-level data that is stored in the document class but is not part of the document query. For example, the documentPurpose (original or copy) and the senderId (the sending company in the application) properties are included in the document schema.
The document query field list always controls which fields are included in the schema and are therefore serialized. However, if the Ax <Table> class is present, only fields that have a corresponding parm <Field> method on the Ax <Table> class are serialized. Calculated fields (display fields that are not fields in the table) have parm <Field> methods on the Ax <Table> class and are serialized.