qbxml

Quickbooks InvoiceAdd qbxml format issue


I must be missing out something in the format of my XML file for adding an invoice to Quickbooks Desktop Enterprise US version, my qbxml request is as follows;

   <?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <InvoiceAddRq>
      <InvoiceAdd>
        <CustomerRef>
          <FullName>XXXXXXXXX</FullName>
        </CustomerRef>
        <ClassRef>
          <FullName>XXXXXXX</FullName>
        </ClassRef>
        <ARAccountRef>
          <FullName>XXXXXXXXXX</FullName>
        </ARAccountRef>
        <TemplateRef>
          <FullName>Standard invoice</FullName>
        </TemplateRef>
        <TxnDate/>
        <RefNumber>83434</RefNumber>
        <BillAddress>
          <Addr1>4xxxxxx</Addr1>
          <City>xxxxxxxx</City>
          <State>XX</State>
          <PostalCode>0000</PostalCode>
        </BillAddress>
        <IsPending>1</IsPending>
        <IsFinanceCharge>0</IsFinanceCharge>
        <PONumber>12345</PONumber>
        <TermsRef>
          <FullName>Net 30</FullName>
        </TermsRef>
        <DueDate/>
        <SalesRepRef/>
        <FOB/>
        <ShipDate/>
        <ShipMethodRef/>
        <ItemSalesTaxRef/>
        <Memo/>
        <CustomerMsgRef/>
        <IsToBePrinted>0</IsToBePrinted>
        <IsToBeEmailed>0</IsToBeEmailed>
        <IsTaxIncluded>0</IsTaxIncluded>
        <CustomerSalesTaxCodeRef/>
        <Other/>
        <ExchangeRate>1</ExchangeRate>
        <SetCredit>
          <CreditTxnID>1</CreditTxnID>
          <AppliedAmount>0</AppliedAmount>
          <Override>1</Override>
        </SetCredit>
        <InvoiceLineAdd>
          <itemRef>
            <FullName>S-check UT</FullName>
          </itemRef>
          <Desc>Interpreter</Desc>
          <Quantity>1</Quantity>
          <UnitOfMeasure/>
          <Rate>10</Rate>
          <RatePercent>100</RatePercent>
          <PriceLevelRef/>
          <ClassRef/>
          <Amount>10</Amount>
          <OptionForPriceRuleConflict>0</OptionForPriceRuleConflict>
          <InventorySiteRef/>
          <InventorySiteLocationRef/>
          <SerialNumber/>
          <LotNumber/>
          <ServiceDate/>
          <SalesTaxCodeRef/>
          <OverrideItemAccountRef/>
          <Other1/>
          <Other2/>
          <LinkToTxn>
            <TxnID>0</TxnID>
            <TxnLineID>0</TxnLineID>
          </LinkToTxn>
          <DataExt>
            <OwnerID>3caa4f6f-fcb3-4767-99e6-0ba5dfd34e8f</OwnerID>
            <DataExtName>Sample</DataExtName>
            <DataExtValue>Sample</DataExtValue>
          </DataExt>
        </InvoiceLineAdd>
      </InvoiceAdd>
    </InvoiceAddRq>
  </QBXMLMsgsRq>
</QBXML>

When i check this xml request using the qbxml validator i'm getting the following error message even though i have supplied all the required fields as outlined in the OSR tool;

   Line: 53
    LinePos: 20
    Src Text: <itemRef>
    Reason: Element content is invalid according to the DTD/Schema.
    Expecting: ItemRef, Desc, Quantity, UnitOfMeasure, Rate, RatePercent, PriceLevelRef, ClassRef, 
    Amount, TaxAmount, OptionForPriceRuleCon....

I'm not sure about what's wrong with my xml file, when i run the quickbooks webconnector, the error message i get is;

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

I understand this is coming up because of the wrong format of my qbxml request which could be incorrect. Kindly assist


Solution

  • I have filtered your QBXML and removed all error producing QBXML tags

        <?xml version="1.0" encoding="utf-8"?>
    <?qbxml version="13.0"?>
    <QBXML>
      <QBXMLMsgsRq onError="stopOnError">
        <InvoiceAddRq>
          <InvoiceAdd>
            <CustomerRef>
              <FullName>XXXXXXXXX</FullName>
            </CustomerRef>
            <ClassRef>
              <FullName>XXXXXXX</FullName>
            </ClassRef>
            <ARAccountRef>
              <FullName>XXXXXXXXXX</FullName>
            </ARAccountRef>
            <TemplateRef>
              <FullName>Standard invoice</FullName>
            </TemplateRef>
            <TxnDate/>
            <RefNumber>83434</RefNumber>
            <BillAddress>
              <Addr1>4xxxxxx</Addr1>
              <City>xxxxxxxx</City>
              <State>XX</State>
              <PostalCode>0000</PostalCode>
            </BillAddress>
            <IsPending>1</IsPending>
            <IsFinanceCharge>0</IsFinanceCharge>
            <PONumber>12345</PONumber>
            <TermsRef>
              <FullName>Net 30</FullName>
            </TermsRef>
            <DueDate/>
            <SalesRepRef/>
            <FOB/>
            <ShipDate/>
            <ShipMethodRef/>
            <ItemSalesTaxRef/>
            <Memo/>
            <CustomerMsgRef/>
            <IsToBePrinted>0</IsToBePrinted>
            <IsToBeEmailed>0</IsToBeEmailed>
            <IsTaxIncluded>0</IsTaxIncluded>
            <CustomerSalesTaxCodeRef/>
            <Other/>
            <ExchangeRate>1</ExchangeRate>
            <SetCredit>
              <CreditTxnID>1</CreditTxnID>
              <AppliedAmount>0</AppliedAmount>
              <Override>1</Override>
            </SetCredit>
            <InvoiceLineAdd>
              <Desc>Interpreter</Desc>
              <Quantity>1</Quantity>
              <UnitOfMeasure/>
              <Rate>10</Rate>
              <ClassRef/>
              <Amount>10</Amount>
              <InventorySiteRef/>
              <InventorySiteLocationRef/>
              <SerialNumber/>
              <ServiceDate/>
              <SalesTaxCodeRef/>
              <OverrideItemAccountRef/>
              <Other1/>
              <Other2/>
              <LinkToTxn>
                <TxnID>0</TxnID>
                <TxnLineID>0</TxnLineID>
              </LinkToTxn>
            </InvoiceLineAdd>
          </InvoiceAdd>
        </InvoiceAddRq>
      </QBXMLMsgsRq>
    </QBXML>