Developer forum

Forum » Integration » Create Order Fail - Live Integration NAV

Create Order Fail - Live Integration NAV

Davy Capiau
Reply

Hi,

We're using DW10 with NAV live integration. We notice the cart always fails. The logs don't really say a lot. Anyone an idea?

 

ebugInfo: Response CalculateOrder (ID: CART1565, CreateOrder: False) received: 'An error occurred processing the request.
Exception: A DotNet variable has not been instantiated.
Attempting to call System.Xml.XmlNode.SelectSingleNode in CodeUnit DW WebService: Get_TextFromNode'.
10/07/2024 01:43:51.415 p.m.: ResponseError: Response is not valid XML format: 'Data at the root level is invalid. Line 1, position 1.'.
10/07/2024 01:43:51.916 p.m.: ConnectionError: Error CalculateOrder Order Id:'CART1565' CreateOrder:'False'
Message:'Response is not valid XML'. 10/07/2024 01:43:52.139 p.m.: DebugInfo: Updating order with ID: ORDER915.
Complete: True. Order submitted from the backend: False
10/07/2024 01:43:52.140 p.m.: DebugInfo: Request CalculateOrder (ID: ORDER915, CreateOrder: True) sent: '
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<tables source="LiveIntegration" submitType="LiveOrderOrCart" referenceName="OrdersPut">
    <table tableName="EcomOrders">
        <item table="EcomOrders">
            <column columnName="OrderCustomerAccessUserExternalId">K18176</column>
            <column columnName="OrderCustomerNumber">K18176</column>
            <column columnName="OrderCustomerName">Dummy</column>
            <column columnName="OrderCustomerAddress">Dummy</column>
            <column columnName="OrderCustomerAddress2"></column>
            <column columnName="OrderCustomerCity">Dummy</column>
            <column columnName="OrderCustomerState"></column>
            <column columnName="OrderCustomerZip">1000</column>
            <column columnName="OrderCustomerCountryCode">BE</column>
            <column columnName="OrderCustomerEmail">davy.capiau@ewings.be</column>
            <column columnName="OrderCustomerPhone">02/515.34.91</column>
            <column columnName="OrderCustomerFax">02/515.32.95</column>
            <column columnName="OrderCustomerCompany">Dummy</column>
            <column columnName="OrderCustomerComment">OPMERKING</column>
            <column columnName="OrderCustomerFirstName"></column>
            <column columnName="OrderCustomerSurname"></column>
            <column columnName="OrderCustomerRefId"></column>
            <column columnName="OrderDeliveryName">Customer Address</column>
            <column columnName="OrderDeliveryAddress">Dummy</column>
            <column columnName="OrderDeliveryAddress2"></column>
            <column columnName="OrderDeliveryCity">BRUXELLES 1</column>
            <column columnName="OrderDeliveryState">BE</column>
            <column columnName="OrderDeliveryZip">1000</column>
            <column columnName="OrderDeliveryCountryCode">BE</column>
            <column columnName="OrderDeliveryEmail">davy.capiau@ewings.be</column>
            <column columnName="OrderDeliveryPhone">02/515.34.91</column>
            <column columnName="OrderDeliveryFax">02/515.32.95</column>
            <column columnName="OrderDeliveryCompany">Dummy</column>
            <column columnName="CreateOrder">True</column>
            <column columnName="OrderId">ORDER915</column>
            <column columnName="OrderAutoId">145</column>
            <column columnName="OrderIntegrationOrderId"></column>
            <column columnName="OrderCurrencyCode">EUR</column>
            <column columnName="OrderDate">2024-10-07T13:42:36</column>
            <column columnName="OrderPaymentMethodName" isInformationalOnly="True">Factuur</column>
            <column columnName="OrderPaymentMethodId">PAY2</column>
            <column columnName="OrderPaymentMethodCode"></column>
            <column columnName="OrderPaymentMethodTermsCode"></column>
            <column columnName="OrderShippingDate"></column>
            <column columnName="OrderReference">BESTELREF</column>
            <column columnName="OrderShippingMethodName" isInformationalOnly="True">Levering</column>
            <column columnName="OrderShippingMethodId">SHIP18</column>
            <column columnName="OrderShippingFee">18.15</column>
            <column columnName="OrderShippingFeeWithoutVat">15</column>
            <column columnName="OrderShippingItemType">ItemCharge</column>
            <column columnName="OrderShippingItemKey">DW-SHIP</column>
            <column columnName="OrderShippingCode"></column>
            <column columnName="OrderShippingAgentCode"></column>
            <column columnName="OrderShippingAgentServiceCode"></column>
            <column columnName="OrderPriceTotal">27.31</column>
            <column columnName="OrderCaptureAmount">0</column>
            <column columnName="OrderVoucherCode"></column>
            <column columnName="OrderTransactionId"></column>
            <column columnName="OrderStateId">OS1</column>
            <column columnName="OrderStateName" isInformationalOnly="True">Nieuw</column>
            <column columnName="ErpControlsDiscount">True</column>
            <column columnName="VatCountryCode">BE</column>
            <column columnName="VatPostingGroup"></column>
            <column columnName="OrderShippingAgent" isCustomField="True"></column>
        </item>
    </table>
    <table tableName="EcomOrderLines">
        <item table="EcomOrderLines">
            <column columnName="OrderLineId">OL695423</column>
            <column columnName="OrderLineOrderId">ORDER915</column>
            <column columnName="OrderLineParentLineId"></column>
            <column columnName="OrderLineProductId">A000003</column>
            <column columnName="OrderLineProductVariantId"></column>
            <column columnName="OrderLineProductNumber">A000003</column>
            <column columnName="OrderLineProductName">Aftakklem Cu 2.5-25² 1 bout</column>
            <column columnName="OrderLineProductIdentifier">A000003..LANG1</column>
            <column columnName="OrderLineQuantity">1</column>
            <column columnName="OrderLineUnitId"></column>
            <column columnName="OrderLinePriceWithoutVat">7.57</column>
            <column columnName="OrderLineUnitPriceWithoutVat">7.57</column>
            <column columnName="NetPrice">0</column>
            <column columnName="OrderLineType">0</column>
            <column columnName="OrderLineTypeName">Product</column>
            <column columnName="OrderLineBom">False</column>
            <column columnName="OrderLineBomItemId"></column>
            <column columnName="OrderLineGiftCardCode"></column>
            <column columnName="OrderLineIsGiftCardDiscount" isCustomField="True">False</column>
            <column columnName="OrderLineFieldValues">&lt;OrderLineFieldValueCollection /&gt;</column>
        </item>
    </table>
    <table tableName="EcomOrderLineFields" />
</tables>

Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hy Davy,
it looks the problem is related to the xml content parsing. However I was not able to reproduce it using yours xml copy/pasting to the Endpoint Management Test tool page connected to the latest version of the codeunit for NAV2018, so I got proper response for it:
<?xml version="1.0" encoding="utf-8"?>
<tables version="1.2.0.19_NAV1.0.19394">
  <table tableName="EcomOrderLines">
    <item table="EcomOrderLines">
      <column columnName="OrderLineProductNumber"><![CDATA[1896-S]]></column>
      <column columnName="OrderLineProductVariantId"><![CDATA[]]></column>
      <column columnName="OrderLineUnitId"><![CDATA[Unit_STK]]></column>
      <column columnName="OrderLineId"><![CDATA[10000]]></column>
      <column columnName="OrderLineQuantity"><![CDATA[1]]></column>
      <column columnName="OrderLineType"><![CDATA[0]]></column>
      <column columnName="OrderLinePriceWithoutVat"><![CDATA[1,005.63]]></column>
      <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[1,005.625]]></column>
      <column columnName="OrderLinePriceWithVat"><![CDATA[1,005.63]]></column>
      <column columnName="OrderLineUnitPriceWithVat"><![CDATA[1,005.63]]></column>
      <column columnName="OrderLinePriceVat"><![CDATA[0]]></column>
      <column columnName="OrderLineUnitPriceVat"><![CDATA[0]]></column>
      <column columnName="OrderLinePriceVatPercent"><![CDATA[0]]></column>
      <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[0]]></column>
    </item>
  </table>
  <table tableName="EcomOrders">
    <item table="EcomOrders">
      <column columnName="OrderShippingMethodName"><![CDATA[Levering]]></column>
      <column columnName="OrderShippingMethodId"><![CDATA[SHIP18]]></column>
      <column columnName="OrderShippingFee"><![CDATA[18.15]]></column>
      <column columnName="OrderCreated"><![CDATA[TRUE]]></column>
      <column columnName="OrderId"><![CDATA[1487]]></column>
      <column columnName="OrderCurrencyCode"><![CDATA[EUR]]></column>
      <column columnName="OrderDate"><![CDATA[10/07/24]]></column>
      <column columnName="OrderPaymentMethodName"><![CDATA[]]></column>
      <column columnName="OrderCustomerName"><![CDATA[Ravel Møbler]]></column>
      <column columnName="OrderCustomerAddress"><![CDATA[Dummy]]></column>
      <column columnName="OrderCustomerAddress2"><![CDATA[]]></column>
      <column columnName="OrderCustomerCity"><![CDATA[Dummy]]></column>
      <column columnName="OrderCustomerCountryCode"><![CDATA[DK]]></column>
      <column columnName="OrderCustomerEmail"><![CDATA[]]></column>
      <column columnName="OrderCustomerFax"><![CDATA[]]></column>
      <column columnName="OrderCustomerPhone"><![CDATA[]]></column>
      <column columnName="OrderCustomerZip"><![CDATA[1000]]></column>
      <column columnName="OrderDeliveryName"><![CDATA[Customer Address]]></column>
      <column columnName="OrderDeliveryAddress"><![CDATA[Dummy]]></column>
      <column columnName="OrderDeliveryAddress2"><![CDATA[]]></column>
      <column columnName="OrderDeliveryCity"><![CDATA[BRUXELLES 1]]></column>
      <column columnName="OrderDeliveryCountryCode"><![CDATA[DK]]></column>
      <column columnName="OrderDeliveryEmail"><![CDATA[]]></column>
      <column columnName="OrderDeliveryFax"><![CDATA[]]></column>
      <column columnName="OrderDeliveryPhone"><![CDATA[]]></column>
      <column columnName="OrderDeliveryZip"><![CDATA[1000]]></column>
      <column columnName="OrderPriceWithVat"><![CDATA[1,023.78]]></column>
      <column columnName="OrderPriceWithoutVat"><![CDATA[1,020.63]]></column>
      <column columnName="OrderPriceVat"><![CDATA[0]]></column>
      <column columnName="OrderSalesDiscount"><![CDATA[0]]></column>
    </item>
  </table>
</tables>


Can you check if you are using fresh code unit version?

Source code for the function in the latest version is this:
    LOCAL PROCEDURE Get_TextFromNode@1000000008(XMLnode@1000000002 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlNode";xpath@1000000000 : Text) : Text;
    VAR
      SelectedXMLnode@1000000001 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlNode";
    BEGIN
      SelectedXMLnode := XMLnode.SelectSingleNode(xpath);
      IF NOT ISNULL(SelectedXMLnode)  THEN
        EXIT( SelectedXMLnode.InnerText)
      ELSE
        EXIT('');
    END;


BR, Dmitrij

 

You must be logged in to post in the forum