Quickbooks 与我期望的 qbXML 版本不兼容

Quickbooks isn't compatible with the version of qbXML that I expect

我有一个使用 Quickbooks SDK 版本 13 构建的自制 C++ 应用程序。 该应用程序的目的是允许我通过从网络端口接收 XML 字符串来与 Quickbooks 交谈。我可以使用 qbXML 2.1 版进行通信。它正在与 Quickbooks Enterprise 版本 16 通信。令我惊讶的是,当我 运行 主机查询时...

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.1"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<HostQueryRq></HostQueryRq>
</QBXMLMsgsRq>
</QBXML>

...输出是这样的:

<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<HostQueryRs statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<HostRet>
<ProductName>Intuit QuickBooks Enterprise Solutions: Manufacturing and Wholesale 16.0</ProductName>
<MajorVersion>26</MajorVersion>
<MinorVersion>0</MinorVersion>
<SupportedQBXMLVersion>1.0</SupportedQBXMLVersion>
<SupportedQBXMLVersion>1.1</SupportedQBXMLVersion>
<SupportedQBXMLVersion>2.0</SupportedQBXMLVersion>
<SupportedQBXMLVersion>2.1</SupportedQBXMLVersion>
</HostRet>
</HostQueryRs>
</QBXMLMsgsRs>
</QBXML>

版本13的SDK显然应该可以使用qbXML的版本13,而Quickbooks Enterprise 16应该兼容高于2.1的qbXML。我需要使用 qbXML 的一个功能,它仅在 qbXML 2.1 之后可用。 These release notes Intuit 表示 Quickbooks Enterprise 14.0 与 qbXML 版本 13.0、12.0、11.0、10.0、9.0、8.0、7.0、6.0、5.0、4.1、4.0、3.0、2.1、2.0、 1.1 和 1.0。当然,16等以后的版本也可以兼容。

为什么 Quickbooks 告诉我它只能使用 qbXML 2.1?我该怎么做才能使用较新的版本?

编辑:抱歉,我忘了在将 <?qbxml version="2.1"?> 更改为 <?qbxml version="13.0"?> 或任何高于 2.1 returns 的值之前提到 80040428 的错误,这意味着 "The current request processor does not support the request." 此外,如果我使用 <?qbxml version="2.0"?>,我仍然会得到 <SupportedQBXMLVersion>2.1</SupportedQBXMLVersion>.

Why is Quickbooks telling me it can only use qbXML 2.1?

因为您只使用 2.1。只需使用不同的版本。 2.1 15岁左右

改变这个:

<?qbxml version="2.1"?>

像这样:

<?qbxml version="13.0"?>

如果使用2.1以上版本出现80040428错误,说明机器安装的SDK版本较旧。您可能需要卸载并重新安装 13.0 SDK。我没有使用过 HostQueryRq,所以不确定这是否是问题所在。这就是我获得支持版本的方式:

IRequestProcessor5 rp = new RequestProcessor3();
rp.OpenConnection2("AppID", "AppName", QBXMLRPConnectionType.localQBD);
string ticket = rp.BeginSession("", QBFileMode.qbFileOpenDoNotCare);
string[] versions = (string[])rp.QBXMLVersionsForSession[ticket];

Why is Quickbooks telling me it can only use qbXML 2.1?

我遇到了同样的问题。我使用的代码是从位于 C:\Program Files (x86)\Intuit\IDN\QBSDK13.0\samples\qbdt\cpp\qbxml\sdktest 的 SDK 中提取的代码,并且得到了支持的 qbXML 版本 1.02.1.

的相同结果

sdktest 代码导入 QBXMLRP.dll(见下文),它仅支持 1.02.1 版本:

/*---------------------------------------------------------------------------
 * FILE: SDKTest.cpp
 *
 * Description:
 * QBXMLRP API tester. Run "sdktest -h" to learn how to use it.
 *
 * Created On: 09/09/2001
 *
 * Copyright (c) 2001-2013 Intuit Inc. All rights reserved.
 * Use is subject to the terms specified at:
 *     http://developer.intuit.com/legal/devsite_tos.html
 *
 */

#include <ctype.h>
#include <ctime>
#include <fstream>
#include <atlbase.h>
#include <iostream>
#include <string>

using namespace std;

#import "QBXMLRP.dll" // this supports only up to v 2.1

QuickBooks SDK Programmer's Guide 状态:

Starting with SDK 3.0, a new Request Processor is available, QBXMLRP2Lib.RequestProcessor2. Only this new Request Processor supports event subscription and other new features of SDK 3.0. Backwards compatibility with the old Request Processor is maintained in the new one.

为了使用更新的QBXMLRP2Lib:

  1. 在Visual Studio
  2. 我不得不create a new CLR c++/cli project
  3. 将其命名为 QBXmlConsole
  4. 使用浏览功能,定位,然后added the referenceInteropt.QBXMLRP2
  5. 在项目的 QBXmlConsole.cpp 文件中添加了类似于下面简单示例的内容

现在,当我 运行,例如 QBXmlConsole.exe < "\Program Files (x86)\Intuit\IDN\QBSDK13.0\samples\xmlfiles\HostQueryRq.xml",我得到支持的版本 1.013.0。如果您 运行 遇到问题,请查看 SDK 的 hostquery 示例。希望对你有帮助。

/** QBXmlConsole.cpp **/
#include "pch.h"
using namespace System;
using namespace Interop::QBXMLRP2; // supports all version of qbXML
int main(array<System::String ^> ^args)
{
    String^ ticket;
    String^ request;
    String^ response;
    String^ line;
    int err = 0;

    while ((line = Console::ReadLine()) != nullptr) {
        if (line->StartsWith("<!--")) {
            continue;
        }
        request = request + line + "\n";
    }

    Console::WriteLine("Processing XML:");
    Console::WriteLine(request);
    Console::WriteLine("--");

    Interop::QBXMLRP2::IRequestProcessor6^ rqPtr = gcnew Interop::QBXMLRP2::RequestProcessor3;

        try {
            rqPtr->OpenConnection2("123", "QBXmlConsole", Interop::QBXMLRP2::QBXMLRPConnectionType::localQBD);
            ticket = rqPtr->BeginSession("", Interop::QBXMLRP2::QBFileMode::qbFileOpenDoNotCare);
            response = rqPtr->ProcessRequest(ticket, request);
            rqPtr->EndSession(ticket);
            rqPtr->CloseConnection();
        }
        catch (Runtime::InteropServices::COMException^) {
            response = "Handled exception: " + rqPtr->GetQBLastError();
            err = 1;
        }


        Console::Write(response);
        Console::WriteLine("Query complete");
        return err;
    }

编辑:我认为完全有可能不导入 QBXMLRP.dll 而只是尝试导入 Interopt.QBXMLRP2Lib.dll,但那是我没试过的东西。