One of the SDETs on our team recently made me aware of a somewhat unintuitive error message that you might receive when sending a message to your AX installation using AIF. In the inbound XML message, the elements must be in alphabetical order. If they are not in the correct order, you may see a message that looks something like this real-world example:
The request failed with the following error: The element 'SalesTable' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder' has invalid child element 'LanguageId' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder'.
List of possible elements expected: 'QuotationId, ReceiptDateConfirmed, ReceiptDateRequested, RecId, RecVersion, Reservation, ReturnDeadline, ReturnItemNum, ReturnReasonCodeId, ReturnReplacementCreated, ReturnReplacementId, ReturnStatus, SalesGroup, SalesId, SalesName, SalesOriginId, SalesPoolId, SalesResponsible, SalesStatus, SalesTaker, SalesType, SalesUnitId, SettleVoucher, ShipCarrierAccount, ShipCarrierAccountCode, ShipCarrierBlindShipment, ShipCarrierDeliveryContact, ShipCarrierDlvType, ShipCarrierExpeditedShipment, ShipCarrierFuelSurcharge, ShipCarrierID, ShipCarrierResidential, ShippingDateConfirmed, ShippingDateRequested, smmCampaignId, smmSalesAmountTotal, StatProcId, TaxGroup, totalBalance, TotalCashDiscount, TotalInvoice, TotalMiscCharges, TotalSalesTax, TransactionCode, Transport, URL, VATNum, SalesLine, DocuRefHeader, MarkupTransHeader' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder'
As you can see, the error message doesn’t exactly come out and say “Hey, your XML elements aren’t in alphabetical order.” It more hints around about it.
This error is returned when the inbound message is validated. So if you encounter this error, you’ll want to start troubleshooting by checking the source XML and the order of the elements. For more information about document schemas in AIF on MSDN, click here.