QuickBooks在解析提供的XML文本流时发现错误(但在验证器和SDKTestPlus3中可以)

时间:2019-12-09 23:08:16

标签: c# quickbooks

我试图弄清为什么我无法处理quickbooks xml请求(QB桌面)。以下测试查询基于验证程序为“有效”,甚至在我使用sdk(SDKTestPlus3)随附的测试工具时也可以使用,但是当我尝试通过应用程序发送该查询时,我收到一条消息,提示有一个解析xml时出错。

具体错误消息是:

System.Runtime.InteropServices.COMException (0x80040400): QuickBooks found an error when parsing the provided XML text stream.
   at Interop.QBXMLRP2.IRequestProcessor4.ProcessRequest(String ticket, String inputRequest)
   at QuickXML.Program.Main(String[] args)

我的要求如下:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError = "stopOnError">
    <JournalEntryAddRq requestID = "1">
      <JournalEntryAdd>
        <TxnDate>2019-12-09</TxnDate>
        <RefNumber>1</RefNumber>
        <JournalCreditLine>                     
          <AccountRef>
            <FullName>11000</FullName>
          </AccountRef>
          <Amount>10.23</Amount>
        </JournalCreditLine>
        <JournalDebitLine>                     
          <AccountRef>
            <FullName>11100</FullName>
          </AccountRef>
          <Amount>10.23</Amount>
        </JournalDebitLine>
      </JournalEntryAdd>
    </JournalEntryAddRq>
  </QBXMLMsgsRq>
</QBXML>

我在C#中使用的简单代码是:

...

String input = ...

RequestProcessor2 rp = null;
string ticket = null, response = null;

try
{
    rp = new RequestProcessor2();
    rp.OpenConnection("", "Test Program");
    ticket = rp.BeginSession("", QBFileMode.qbFileOpenDoNotCare);
    response = rp.ProcessRequest(ticket, input);
}

...

0 个答案:

没有答案