Bendrinti naudojant


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 <MessageParts> Tag

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.

Tags Required for <Action> Values

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.

Tags in the <Body> of Inbound Messages

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

  • <serviceExternalName>

    • <entityName>

Examples could be as follows:

  • <Customer>

    • <CustTable>

The following example shows the XML for a Create action for the LedgerJournal document.

<Body>
        <MessageParts xmlns = "https://schemas.microsoft.com/dynamics/2008/01/
        documents/Message">
        <LedgerJournal xmlns = "https://schemas.microsoft.com/dynamics/2008/01/
        documents/LedgerJournal">
        <LedgerJournalTable class="entity">
            <CurrencyCode>USD</CurrencyCode>
            <JournalName>Day1</JournalName>
            <JournalTotalCredit>50</JournalTotalCredit>
            <JournalTotalDebit>50</JournalTotalDebit>
            <JournalType>Daily</JournalType>
            <Name>Daily Journal 1</Name>
            <VoucherSeries>Ledger_3</VoucherSeries>
        <LedgerJournalTrans class="entity">        
            <AccountNum>11010</AccountNum>
            <AccountType>Ledger</AccountType>
            <AmountCurDebit>50</AmountCurDebit>
            <CurrencyCode>USD</CurrencyCode>
            <DocumentDate>2007-05-28</DocumentDate>
            <Invoice>00003</Invoice>
            <OffsetAccount>12020</OffsetAccount>
            <OffsetAccountType>Ledger</OffsetAccountType>
            <TransDate>2007-05-28</TransDate>
            <Txt>AxLedgerJournal inbound test trans 1</Txt>
        </LedgerJournalTrans>      
        </LedgerJournalTable>  
        </LedgerJournal>
        </MessageParts>
    </Body>

Delete

  • <EntityKeyList>

    • <EntityKey>

Find

  • <QueryCriteria>

    • <CriteriaElement>

FindKeys, GetKeys, GetChangedKeys

  • <QueryCriteria>

    • <CriteriaElement>

Read

Same as Delete.

Update

The following tags must come first:

  • <EntityKeyList>

    • <EntityKey>

The following tags must come next:

  • <serviceExternalName>

    • <entityName>

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.

Tags in the <Body> of Outbound Messages

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

  • <EntityKeyList>

    • <EntityKey>

Delete

The <MessageParts> tag section is empty.

Find

  • <serviceExternalName>

    • <entityName>

FindKeys, GetKeys, GetChangedKeys

  • <EntityKeyList>

    • <EntityKey>

Read

Same as Find.

Update

Same as Delete.

Details About Each Tag in the <Body> Section

The following sections discuss the tags in more detail.

<EntityKeyList> Tag

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">

<EntityKey> Tag

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>.

<EntityKey> Example

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>

<serviceExternalName> Tag

This tag is named for the document service that is specified in the <Action> tag.

<entityName> 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.

<QueryCriteria> 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.

<CriteriaElement> Tag

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.

XSD Validations

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:

See also

AIF Messages

Query Criteria Overview

Example: Fault in an Outbound Message

Message Header