我正在尝试使用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请求中发送多个销售订单,或者它只接受1个请求中的一个订单?
答案 0 :(得分:5)
每当您看到此错误消息时:
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>