Search code examples
phpquickbooksintuit-partner-platformqbxmlqbwc

Quickbooks Web Connector suddenly throws 0x80040400 error


Until recently, I have been able to push sales orders using the Consolibyte PHP Web Connector just fine. Now, it is throwing the error

0x80040400: QuickBooks found an error when parsing the provided XML text stream.

I have removed all optional elements of the XML but it is still throwing the error. The simplest bit of XML I can produce that errors is this:

<?xml version="1.0" encoding="UTF-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="continueOnError">
    <SalesOrderAddRq>
      <SalesOrderAdd>
        <CustomerRef>
          <ListID>80002DBC-1342467727</ListID>
        </CustomerRef>
      </SalesOrderAdd>
    </SalesOrderAddRq>
  </QBXMLMsgsRq>
</QBXML>

I have compared this to what the OSR tells me I should expect, and I ran it through the XML validator found in the QB SDK, but everything says it is well-formed. I also ran a CustomerQuery on that specific ListID, and it returned a valid customer in Quickbooks. Any ideas what could be wrong here?

Edit: Despite the OSR saying that all elements other than CustomerRef are optional, I reran the validator from the latest SDK (which I thought I was using before) and it said that the XML expected all those things. Here is the full XML that the validator says is valid, but still throws the error:

<?xml version="1.0" encoding="UTF-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="continueOnError">
    <SalesOrderAddRq>
      <SalesOrderAdd>
        <CustomerRef>
          <ListID>80002DBC-1342467727</ListID>
        </CustomerRef>
        <TxnDate>2014-12-12</TxnDate>
        <RefNumber>14942</RefNumber>
        <BillAddress>
          <Addr1>redacted</Addr1>
          <Addr2>redacted</Addr2>
          <City>redacted</City>
          <State>IL</State>
          <PostalCode>12345</PostalCode>
        </BillAddress>
        <ShipAddress>
          <Addr1>redacted</Addr1>
          <Addr2>redacted</Addr2>
          <City>redacted</City>
          <State>IL</State>
          <PostalCode>12345</PostalCode>
        </ShipAddress>
        <DueDate>2015-02-20</DueDate>
        <Memo>redacted</Memo>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>8000418C-1393430847</ListID>
          </ItemRef>
          <Quantity>61</Quantity>
          <Rate>334.00</Rate>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>80003E9F-1382701326</ListID>
          </ItemRef>
          <Quantity>61</Quantity>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>8000490D-1417183681</ListID>
          </ItemRef>
          <Quantity>50</Quantity>
          <Rate>349.00</Rate>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>80003E9F-1382701326</ListID>
          </ItemRef>
          <Quantity>50</Quantity>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>80003D0C-1377271839</ListID>
          </ItemRef>
          <Quantity>111</Quantity>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <FullName>Subtotal</FullName>
          </ItemRef>
        </SalesOrderLineAdd>
        <SalesOrderLineAdd>
          <ItemRef>
            <ListID>80004710-1409243586</ListID>
          </ItemRef>
        </SalesOrderLineAdd>
      </SalesOrderAdd>
    </SalesOrderAddRq>
  </QBXMLMsgsRq>
</QBXML>

Solution

  • I discovered the problem. Unfortunately, no one would have been able to help as I had to remove sensitive information from the example, which is where the problem was.

    The issue was that in the Memo element, there was a unicode character (–). This caused the XML to be invalid, despite the fact that it passes when run through the qbValidator tool. Removing the character allowed the sales order to be added correctly.