Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Configuration AIF on AX 2012 R3

(0) ShareShare
ReportReport
Posted on by 45

Dear All,

Could someone help me with the issue when I create a sales order from an XML file via AIF set up on AX 2012 R3.

1. I created service with schema as below.

<?xml version="1.0" encoding="utf-16" ?>
- <xs:schema xmlns:tns="schemas.microsoft.com/.../SalesOrder" xmlns:st="schemas.microsoft.com/.../sharedtypes" elementFormDefault="qualified" targetNamespace="schemas.microsoft.com/.../SalesOrder" xmlns:xs="www.w3.org/.../XMLSchema">
  <xs:import schemaLocation="SharedTypes.xsd" namespace="schemas.microsoft.com/.../sharedtypes" />
  <xs:element name="SalesOrder" type="tns:AxdSalesOrder" />
- <xs:complexType name="AxdSalesOrder">
- <xs:sequence>
  <xs:element minOccurs="0" maxOccurs="unbounded" name="SalesTable" type="tns:AxdEntity_SalesTable" />
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="AxdEntity_SalesTable">
- <xs:sequence>
  <xs:element minOccurs="0" name="DefaultDimension" nillable="true" type="st:AxdType_DimensionAttributeValueSet" />
  <xs:element minOccurs="1" name="PurchOrderFormNum" type="st:AxdExtType_CustPurchaseOrder" />
  <xs:element minOccurs="1" name="ReceiptDateRequested" type="st:AxdExtType_SalesReceiptDateRequested" />
  <xs:element minOccurs="0" maxOccurs="unbounded" name="SalesLine" type="tns:AxdEntity_SalesLine" />
  <xs:element minOccurs="0" maxOccurs="unbounded" name="MarkupTransHeader" type="tns:AxdEntity_MarkupTransHeader" />
  </xs:sequence>
  <xs:attribute fixed="entity" name="class" use="required" />
  <xs:attribute name="action" type="st:AxdEnum_AxdEntityAction" />
  </xs:complexType>
- <xs:complexType name="AxdEntity_SalesLine">
- <xs:sequence>
  <xs:element minOccurs="0" name="DefaultDimension" nillable="true" type="st:AxdType_DimensionAttributeValueSet" />
  <xs:element minOccurs="1" name="SalesQty" type="st:AxdExtType_SalesOrderedQty" />
  <xs:element minOccurs="1" name="SalesUnit" type="st:AxdUnion_AxdExtType_SalesUnit_AxdType_ExtCodeValue" />
  <xs:element minOccurs="0" maxOccurs="unbounded" name="MarkupTransLine" type="tns:AxdEntity_MarkupTransLine" />
  </xs:sequence>
  <xs:attribute fixed="entity" name="class" use="required" />
  <xs:attribute name="action" type="st:AxdEnum_AxdEntityAction" />
  </xs:complexType>
- <xs:complexType name="AxdEntity_MarkupTransLine">
- <xs:sequence>
  <xs:element minOccurs="1" name="MarkupCode" type="st:AxdUnion_AxdExtType_MarkupCode_AxdType_ExtCodeValue" />
  </xs:sequence>
  <xs:attribute fixed="entity" name="class" use="required" />
  <xs:attribute name="action" type="st:AxdEnum_AxdEntityAction" />
  </xs:complexType>
- <xs:complexType name="AxdEntity_MarkupTransHeader">
- <xs:sequence>
  <xs:element minOccurs="1" name="MarkupCode" type="st:AxdUnion_AxdExtType_MarkupCode_AxdType_ExtCodeValue" />
  </xs:sequence>
  <xs:attribute fixed="entity" name="class" use="required" />
  <xs:attribute name="action" type="st:AxdEnum_AxdEntityAction" />
  </xs:complexType>
  </xs:schema>
2. I created XML file with the info
<?xml version="1.0" encoding="utf-8" ?>
<Envelope xmlns="">schemas.microsoft.com/.../Message">
<Header>
<MessageId>{5603D03A-4380-404D-9F27-738BE0FEA13E}</MessageId>
<Action>schemas.microsoft.com/.../Action>
</Header>
<Body>
<MessageParts>
<SalesOrder xmlns="">schemas.microsoft.com/.../SalesOrder">
<SalesTable class="entity">
<CustAccount>HCM-00481</CustAccount>
<PurchOrderFormNum>LuisTestPO</PurchOrderFormNum>
<DeliveryDate>04-15-2021</DeliveryDate>
<ReceiptDateRequested>04-15-2021</ReceiptDateRequested>
<SalesLine class="entity">
<ItemId>P00916</ItemId>
<SalesQty>18</SalesQty>
<SalesUnit>Pcs</SalesUnit>
</SalesLine>
</SalesTable>
</SalesOrder>
</MessageParts>
</Body>
</Envelope>
3. I added 4 jobs on the batch with the condition complete task 1 to do task2... task 3, task 4 the same
=> the batch job runs well, however, the sales order didn't create, the system always shows the message in the exception 'Invalid message schema. Could someone have a look for me?

Thank and regards,

Luis

  • Martin Dráb Profile Picture
    Martin Dráb 231,403 Most Valuable Professional on at
    RE: Configuration AIF on AX 2012 R3

    First of all, let me report your XML with Insert > Insert Code:

    schemas.microsoft.com/.../Message">
      
    {5603D03A-4380-404D-9F27-738BE0FEA13E} schemas.microsoft.com/.../Action>
    schemas.microsoft.com/.../SalesOrder"> HCM-00481 LuisTestPO 04-15-2021 04-15-2021 P00916 18 Pcs

    It's not actually well-formed XML, because Action and SalesOrder elements aren't closed correctly. Also, Action contains a wrong value (it should be schemas.microsoft.com/.../create) and SalesOrder has xmlns empty (and the value looks wrong as well, because it should start with http://).

    Maybe these errors are caused by posting code here in a wrong way, maybe not - we can't know that.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Configuration AIF on AX 2012 R3

    If AX doesn't give you descriptive error messages, I warmly suggest to use some online tool to check your XML message against the schema. However just by looking at it, we can immediately see that you have problems.

    Your schema says that SalesTable section in the file should have following elements:

    • DefaultDimension (optional)
    • PurchOrderFormNum (mandatory)
    • ReceiptDateRequested (mandatory)

    And your message has following elements:

    • CustAccount
    • PurchOrderFormNum
    • DeliveryDate
    • ReceiptDateRequested

    Also in SalesLine you try to import ItemId but your schema doesn't have it. 

    To me it looks that your schema has some issue because it doesn't have information such as customer account or item id, which are mandatory information when you create sales orders in AX.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,403 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans