How to: Enable Checking for Duplicate Messages

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

This topic describes how to enable checking for duplicate messages in Application Integration Framework (AIF). Each XML message that comes into AIF has a header that contains identification information such as the message ID and the service operation being called. For more information, see Message Header.

The MessageId element in the header contains a GUID that uniquely identifies each inbound message. If you do not provide a MessageId value, AIF generates one when the message is received.

If you want to enable AIF to check for duplicate messages, you must complete two steps:

  • Ensure that the message MessageId element has a value.

  • Set the EnableIdempotence property for the service operation to Yes.

AIF checks for duplicate messages at the service operation level. You must set the EnableIdempotence property for each service operation for which you want to check for duplicates.

By default, the EnableIdempotence property is set to Yes for the create, delete, and update service operations for the document services that are included with Microsoft Dynamics AX. Therefore, if you want to enable checking for duplicates, you must explicitly add a GUID that you created for the MessageId element of the inbound message.

If you have the EnableIdempotence property for a service method set to Yes, you can still send in messages without a MessageId value. However, if there is no MessageId, AIF assigns it a unique GUID and never returns a duplicate message error.

When AIF receives a duplicate message, it sends an error response and the following error appears in the Exceptions form:

Duplicate message. Message has already been processed.

The response message that contains the error is sent back to the calling application and resembles the following code.

<?xml version="1.0" encoding="utf-8" ?> 
<Envelope xmlns="
        <MessageParts xmlns="">
            <Fault xmlns="
                    <Text xml:lang="EN-US">Duplicate message. 
                        Message has already been processed.</Text> 

Enable Checking for Duplicates

To enable checking for duplicate messages

  1. In the AOT, expand the Services node, expand the service, expand the Operations node, right-click the service operation, and then click Properties.

  2. Set the EnableIdempotence property to Yes.

  3. Set the value of the MessageId in the inbound message to a specific GUID.

See also

AIF Messages

Messages and transforms in AIF