Message Body
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
This topic describes the <Body> tag section of inbound and outbound messages in Application Integration Framework (AIF). The <Body> tag must follow the closing </Header> tag. For more information about messages and their format in Microsoft Dynamics AX, see Messages and transforms in AIF.
For examples of inbound and outbound messages, see Example of Inbound XML Message and Example of Outbound XML Message.
The first tag nested under <Body> must be the <MessageParts> tag. There is no requirement to specify the xmlns attribute on the <MessageParts> tag because the correct value is already specified on the outer <Envelope> tag.
The values in the <Action> tag determine the XSD schema validations that are applied to the contents of the <Body> tag. The <Action> tag is nested under the <Header> tag.
For more information about actions, see Document Class Service Operations.
The outermost tag in each table cell occurs immediately after the <MessageParts> tag, and is nested directly under the <MessageParts> tag. The following example shows the nesting relationship between the <MessageParts> tag and the tags in the body of an inbound Find message .
<Body>
<MessageParts>
<QueryCriteria>
<CriteriaElement>
...
</CriteriaElement>
</QueryCriteria>
</MessageParts>
</Body>
For inbound messages, the following table shows the XML tags that must be in the <Body> tag section for each action.
Service operation in <Action> |
Tags in the inbound <Body> |
---|---|
Create |
Examples could be as follows:
The following example shows the XML for a Create action for the LedgerJournal document.
|
Delete |
|
Find |
|
FindKeys, GetKeys, GetChangedKeys |
|
Read |
Same as Delete. |
Update |
The following tags must come first:
The following tags must come next:
The tags <EntityKeyList> and <serviceExternalName> are at the same level of nesting under <MessageParts>. Both tags are nested one level deeper than <MessageParts>, which is their parent tag. The <EntityKey> tag sequence must align with the <entityName> tag sequence. |
For outbound messages, the following table shows the XML tags that occur in the <Body> tag section for each action.
Service operation in <Action> |
Tags in the outbound <Body> |
---|---|
Create |
|
Delete |
The <MessageParts> tag section is empty. |
Find |
|
FindKeys, GetKeys, GetChangedKeys |
|
Read |
Same as Find. |
Update |
Same as Delete. |
The following sections discuss the tags in more detail.
The <EntityKeyList> tag section contains one or more <EntityKey> tags. The following is the correct syntax for the <EntityKeyList> tag (with a line break added to improve this display).
<EntityKeyList xmlns = "http://schemas/microsoft.com/
dynamics/2008/01/documents/Message">
Each record in a table is uniquely identified by its value in the key field. In some tables the key is a set of two or more fields. The <EntityKey> tag section specifies the name and value for each key field. Each <EntityKey> section identifies at most one record.
The service class specified in the <Action> tag determines the table (or data source) that contains the records targeted by the <EntityKey>.
The following XML code is an example of the <EntityKey> tag section. It identifies the record that has a value of 4507 in its AccountNum field. Not shown is XML code elsewhere in the message that relates this <EntityKey> to the CustTable table.
<EntityKey xmlns = "https://schemas.microsoft.com/
dynamics/2006/02/documents/EntityKey">
<KeyData>
<KeyField>
<Field>AccountNum</Field>
<Value>4507</Value>
</KeyField>
</KeyData>
</EntityKey>
This tag is named for the document service that is specified in the <Action> tag.
This tag is the name of the table (or data source) that the inbound message operates against. Nested under this tag are tags for each field in the table (or a subset of those field tags).
Also, nested under this tag could be another <entityName> tag for a child table. This can occur for create and update <Action> operations. For example, under the <SalesOrderTable> tag there can be a <SalesLine> tag.
The <QueryCriteria> tag section contains one or more <CriteriaElement> tags. The <QueryCriteria> tag offers more flexibility than does the <EntityKeyList> tag. Unlike the <EntityKeyList> tag, the <QueryCriteria> tag never occurs in an outbound message.
For more information, see Query Criteria Overview.
For matching records, the <CriteriaElement> tag section can specify field-value pairs that are not limited to key fields. The <CriteriaElement> tag also offers several operators beyond the equals operator.
The XSD schemas that are used to validate all parts of each message are stored in the following directory where you installed Microsoft Dynamics AX:
- Program files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\Application\Share\Include
For more information about XSD schema, see the following topics: