axaptadynamics-ax-2012x++dynamics-ax-2012-r2aif

When I call an AIF service from C# to create a SO, my XML doesn't look like I would expect


I'm experimenting with AIF to create a basic SO from C# following this general guide from Microsoft. I have two questions.

The only information I'm passing is this:

        // Create instances of the entities that are used in the service and
        // set the needed fields on those entities.
        AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();
        salesTable.CurrencyCode = "USD";
        salesTable.CustAccount = "100003";
        salesTable.DeliveryDate = Convert.ToDateTime("1/14/2016");
        salesTable.Payment = "Net30";
        salesTable.PurchOrderFormNum = "PO";

        AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
        salesLine.ItemId = "44417";
        salesLine.SalesQty = 3;
        salesLine.SalesUnit = "ea";
  1. Why is it that when I examine the XML, it looks like it's passing tons of extra fields: XMLScreen

  2. What does this error mean? EInvoiceAccountCode appears to be a base field on SalesTable, and I tried Tools>Application Integration Framework>Update document service to update the SalesSalesOrder service.

Invalid document schema. The following error was returned: The element 'SalesTable' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder' has invalid child element 'EInvoiceAccountCode' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder'. List of possible elements expected: 'DlvTerm' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder'.


Solution

  • 1) Everything is flagged as Nillable by Ax (for several reasons). Nillable VS MinOccurs 0

    2) You are passing an element "EInvoiceAccountCode" in your request. But it's expecting an "DlvTerm" element at that location.