2

我正在尝试使用 Quickbooks Webconnector 向 Quickbooks 添加销售订单。当我添加单个订单时,它已成功添加,但是当我尝试在单个 qbxml 中添加多个订单时,quickbooks 会引发以下错误。

"message="QuickBooks 在解析提供的 XML 文本流时发现错误。"

以下是发送的请求 QBXML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?qbxml version="8.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <SalesOrderAddRq>
            <SalesOrderAdd defMacro="MACROTYPE">
                <CustomerRef>
                    <FullName>Amazon.com.nvdc, Inc</FullName>
                </CustomerRef>
                <TxnDate>2014-07-29</TxnDate>
                <BillAddress>
                    <Addr1>RNO1</Addr1>
                    <City>Fernley</City>
                    <State>NV</State>
                    <PostalCode>89408-8903</PostalCode>
                    <Country>US</Country>
                </BillAddress>
                <PONumber>TST00003</PONumber>
                <DueDate>2014-07-29</DueDate>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLU</FullName>
                    </ItemRef>
                    <Desc>ES-10BLU</Desc>
                    <Quantity>3</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLUINVALID</FullName>
                    </ItemRef>
                    <Desc>ES-10BLUINVALID</Desc>
                    <Quantity>4</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLUDISC</FullName>
                    </ItemRef>
                    <Desc>ES-10BLUDISC</Desc>
                    <Quantity>5</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
            </SalesOrderAdd>
            <SalesOrderAdd defMacro="MACROTYPE">
                <CustomerRef>
                    <FullName>Amazon.com.nvdc, Inc</FullName>
                </CustomerRef>
                <TxnDate>2014-07-29</TxnDate>
                <BillAddress>
                    <Addr1>RNO1</Addr1>
                    <City>Fernley</City>
                    <State>NV</State>
                    <PostalCode>89408-8903</PostalCode>
                    <Country>US</Country>
                </BillAddress>
                <PONumber>TST00004</PONumber>
                <DueDate>2014-07-29</DueDate>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLU</FullName>
                    </ItemRef>
                    <Desc>ES-10BLU</Desc>
                    <Quantity>3</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLUINVALID</FullName>
                    </ItemRef>
                    <Desc>ES-10BLUINVALID</Desc>
                    <Quantity>4</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLUDISC</FullName>
                    </ItemRef>
                    <Desc>ES-10BLUDISC</Desc>
                    <Quantity>5</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
            </SalesOrderAdd>
            <SalesOrderAdd defMacro="MACROTYPE">
                <CustomerRef>
                    <FullName>Amazon.com.nvdc, Inc</FullName>
                </CustomerRef>
                <TxnDate>2014-07-29</TxnDate>
                <BillAddress>
                    <Addr1>RNO1</Addr1>
                    <City>Fernley</City>
                    <State>NV</State>
                    <PostalCode>89408-8903</PostalCode>
                    <Country>US</Country>
                </BillAddress>
                <PONumber>TST00005</PONumber>
                <DueDate>2014-07-29</DueDate>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLU</FullName>
                    </ItemRef>
                    <Desc>ES-10BLU</Desc>
                    <Quantity>3</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLUINVALID</FullName>
                    </ItemRef>
                    <Desc>ES-10BLUINVALID</Desc>
                    <Quantity>4</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
                <SalesOrderLineAdd>
                    <ItemRef>
                        <FullName>ES-10BLUDISC</FullName>
                    </ItemRef>
                    <Desc>ES-10BLUDISC</Desc>
                    <Quantity>5</Quantity>
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <Rate>100.0</Rate>
                </SalesOrderLineAdd>
            </SalesOrderAdd>
        </SalesOrderAddRq>
    </QBXMLMsgsRq>
</QBXML>

quickbooks 是否支持在一个 qbxml 请求中发送多个销售订单,或者它只接受一个请求中的一个订单?

4

1 回答 1

6

每当您看到此错误消息时:

QuickBooks 在解析提供的 XML 文本流时发现错误。

您应该做的第一件事是通过QuickBooks SDK中包含的XML Validator工具运行您的 XML 。

如果你这样做,你会得到这个:

Line: 48
LinePos: 49
Src Text: <SalesOrderAdd defMacro="MACROTYPE">
Reason: Element content is invalid according to the DTD/Schema.
Expecting: IncludeRetElement.

这基本上告诉你这个标签:

<SalesOrderAdd

在这条线上:

Line: 48

是不对的。

</SalesOrderAddRq>这是不正确的,因为您在打开新标签之前没有关闭<SalesOrderAdd>标签。您应该在第 48 行左右使用它:

    </SalesOrderAdd>
</SalesOrderAddRq>  <!-- close the first request we're making... -->

<SalesOrderAddRq>  <!-- ... before starting our second request -->
    <SalesOrderAdd>
于 2014-08-06T11:56:16.383 回答