我們將 Quickbooks Web 連接器 (QBWC) 與 Consolibyte Quickbooks PHP Dev Kit 一起使用。我們在 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 拒絕了它.
uj5u.com熱心網友回復:
已解決 - 對 QBWC 的 XML 回應在 XML 宣告之前有一個額外的換行符,這導致 QBWC 完全拒絕它。額外字符的來源是一個 PHP 組態檔,在第一個<?php標簽之前有一個空行。呸!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/362159.html
