Quickbooks Web 连接器“响应不是格式良好的 XML”错误

Posted

技术标签:

【中文标题】Quickbooks Web 连接器“响应不是格式良好的 XML”错误【英文标题】:Quickbooks Web Connector "Response is not well-formed XML" error 【发布时间】:2021-12-28 19:08:59 【问题描述】:

我们将 Quickbooks Web 连接器 (QBWC) 与 Consolibyte Quickbooks php 开发工具包一起使用。我们已经在 QBWC 工作了 4 年,使用该软件没有出现重大问题;但是,现在我们添加了一个额外的 QBWC 作业来访问不同的 QB 公司文件和不同的处理程序。每次运行此作业时都会收到错误“响应不是格式正确的 XML”:

20211117.18:47:19 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20211117.18:47:19 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20211117.18:47:19 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: SCS Consulting QB Integrator Prod 2
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): SCS Consulting QB Integrator Prod 2
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://nest.scscertified.com/quickbooks/qbwc_integrator.php?legal_entity=scs_consulting
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : Actual error received from web service for serverVersion call: <Response is not well-formed XML.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-serverVersion.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : This application does not contain support for serverVersion. Allowing update operation for backward compatibility.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.2.0.71">
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.updateWS() : Actual error received from web service for clientVersion call: <Response is not well-formed XML.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-clientVersion.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application does not contain support for clientVersion. Allowing update operation for backward compatibility.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'SCS Consulting QB Integrator Prod 2', username = 'scsc_qb'
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="scsc_qb"><password=<MaskedForSecurity>
20211117.18:47:21 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
Response is not well-formed XML.

错误从 serverVersion() 开始,但直到 authenticate() 作业才真正失败。似乎问题出在 PHP 处理程序中;但是,它没有记录任何错误,并且开发工具包日志表显示了正确的 XML:

 | Handler is starting up...: Array
(
    [qb_company_file] => 
    [qbwc_min_version] => 
    [qbwc_wait_before_next_update] => 
    [qbwc_min_run_every_n_seconds] => 
    [qbwc_version_warning_message] => 
    [qbwc_version_error_message] => 
    [qbwc_interactive_url] => 
    [autoadd_missing_requestid] => 1
    [check_valid_requestid] => 1
    [server_version] => PHP QuickBooks SOAP Server v3.0 at /quickbooks/qbwc_integrator.php?legal_entity=scs_consulting
    [authenticate] => 
    [authenticate_dsn] => 
    [map_application_identifiers] => 1
    [allow_remote_addr] => Array
        (
        )

    [deny_remote_addr] => Array
        (
        )

    [convert_unix_newlines] => 1
    [deny_concurrent_logins] => 
    [deny_concurrent_timeout] => 60
    [deny_reallyfast_logins] => 
    [deny_reallyfast_timeout] => 600
    [masking] => 1
)

 | 2021-11-17 10:47:20
|-
 | 697
 | 
 | 0
 | Incoming HTTP Headers: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://developer.intuit.com/serverVersion"
Host: nest.scscertified.com
Content-Length: 300
Expect: 100-continue
Connection: Keep-Alive

 | 2021-11-17 10:47:20
|-
 | 698
 | 
 | 0
 | Incoming SOAP Request: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><serverVersion xmlns="http://developer.intuit.com/" /></soap:Body></soap:Envelope>
 | 2021-11-17 10:47:20
|-
 | 699
 | 
 | 0
 | serverVersion()
 | 2021-11-17 10:47:20
|-
 | 700
 | 
 | 0
 | Outgoing SOAP Response: <?xml version="1.0" encoding="UTF-8"?>
            <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
             xmlns:ns1="http://developer.intuit.com/">
                <SOAP-ENV:Body><ns1:serverVersionResponse><ns1:serverVersionResult>PHP QuickBooks SOAP Server v3.0 at /quickbooks/qbwc_integrator.php?legal_entity=scs_consulting</ns1:serverVersionResult></ns1:serverVersionResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>

我不明白的是,PHP 处理程序对 serverVersion() 的 XML 响应看起来不错(实际上与工作处理程序返回的 XML 相同,但 URL 除外),并且此处理程序没有记录任何错误,但 QBWC正在拒绝它。

【问题讨论】:

我们可能没有足够的信息来诊断,但读取 *** Calling clientVersion() with following parameter:&lt;productVersion="2.2.0.71"&gt; 的日志行要么是错误的日志语法选择,要么是您的 XML 格式不正确问题的线索。 感谢您的回复,虽然这只是日志语法而不是问题的根源。 不客气。很高兴你figured it out。 ?????? 【参考方案1】:

已解决 - 对 QBWC 的 XML 响应在 XML 声明之前有一个额外的换行符,这导致 QBWC 完全拒绝它。额外字符的来源是一个 PHP 配置文件,在第一个 &lt;?php 标记之前有一个空行。呵呵!

【讨论】:

以上是关于Quickbooks Web 连接器“响应不是格式良好的 XML”错误的主要内容,如果未能解决你的问题,请参考以下文章

Quickbooks Webconnector(带有 DevKit)“查询请求在 QuickBooks 中找不到匹配的对象”

关于用Webservice连接QuickBooks Online实现于IOS App数据同步功能的个人记录

Quickbooks网上银行/WebBrowser问题[关闭]

json QuickBooks Online v3 OpenAPI

json QuickBooks Online V3 API OpenAPI

Access 2013 中的 VB 脚本在 QuickBooks Enterprise 14 中产生“内存不足”错误