Search code examples
quickbooksqbxmlqbfc

Consolibyte QuickBooks PHP Library - XML Validator Not Working


I have the following XML request to add a new Quickbooks bill:

<?xml version="1.0" encoding="utf-8"?>
    <?qbposxml version="3.0"?>
    <QBPOSXML>
        <QBPOSXMLMsgsRq onError="stopOnError">
            <BillAddRq>
                <BillAdd defMacro="MACROTYPE"> <!-- required -->
                    <VendorRef> <!-- required -->
                        <ListID>80012448-1569211475</ListID> <!-- optional -->
                    </VendorRef>
                    <TxnDate>2019-06-28</TxnDate> <!-- optional -->
                    <DueDate>2019-06-29</DueDate> <!-- optional -->
                    <RefNumber>Ref12345</RefNumber> <!-- optional -->
                    <Memo>Memo12345</Memo> <!-- optional -->
                    <ExternalGUID>ExternalGUID12345</ExternalGUID> <!-- optional -->
                    <ExpenseLineAdd defMacro="MACROTYPE"> <!-- optional, may repeat -->
                        <AccountRef> <!-- optional -->
                            <FullName>Casual Labor:Moving</FullName> <!-- optional -->
                        </AccountRef>
                        <Amount>99.99</Amount> <!-- optional -->
                        <Memo>VillageMemo12345</Memo> <!-- optional -->
                    </ExpenseLineAdd>
                </BillAdd>
            </BillAddRq>
        </QBPOSXMLMsgsRq>
    </QBPOSXML>

Web connector is returning a 0x80040400: QuickBooks found an error when parsing the provided XML text stream. error with the above. I followed this post over at Intuit's support forums to try to use the built-in XML validator.

When I run my XML request through the validator, I get the following error:

enter image description here

How do I resolve the above validator error? Also, is there another way to validate QB XML other than using the built-in validator?


Solution

  • The platform choice you make in the validator, needs to match the platform choice you're targeting in your XML.

    You're choosing to validate against:

    • QuickBooks (US Editions)

    But your qbXML is for:

    • <?qbposxml version="3.0"?> <QBPOSXML> (QuickBooks Point of Sale)

    Since your validating against something that isn't your actual qbXML target, of course the validation is going to fail. It's invalid for what you've chosen.

    If you're developing for Point of Sale, then validate against Point of Sale.

    If you're developing for US editions of QuickBooks, then put in some qbXML for US versions of QuickBooks and validate that.