Search code examples
phpquickbooks

QuickBooks found an error when parsing the provided XML text stream


I am using Consolibyte PHP SDK for QuickBooks Desktop. I have got this error when I have tried to get Bills from the QuickBooks Desktop-

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

The XML Request is given below and I think the XML is valid and the endpoint BillQuery supports IteratiorID-

<?xml version="1.0" encoding="utf-8"?>
    <?qbxml version="13.0"?>
        <QBXML>
            <QBXMLMsgsRq onError="stopOnError">
                <BillQueryRq  iterator="Start"   requestID="1">
                    <MaxReturned>10</MaxReturned>
                    <FromModifiedDate>1983-01-02T12:01:01</FromModifiedDate>
                    <IncludeLineItems>true</IncludeLineItems>
                    <OwnerID>0</OwnerID>
                </BillQueryRq>  
            </QBXMLMsgsRq>
        </QBXML>

Solution

  • Go look at the OSR documentation:

    The FromModifiedDate filter is very clearly wrapped inside another XML node:

    <ModifiedDateRangeFilter> <!-- optional -->
      <FromModifiedDate >DATETIMETYPE</FromModifiedDate> <!-- optional -->
      <ToModifiedDate >DATETIMETYPE</ToModifiedDate> <!-- optional -->
    </ModifiedDateRangeFilter>
    

    Fix your XML so that it conforms to what the OSR shows.

    If you'd taken the time to search, you'd find that there is an XML Validator tool included with the SDK which will tell you exactly what the error in your XML is.