Consolibyte PHP QuickBooks Desktop - 客户端找到响应内容

Consolibyte PHP QuickBooks Desktop - Client found response content

我正在使用 Consolibyte SDK。它在我的本地服务器 (XAMPP) 上运行良好,但是当我将它移动到我公司基于 Laravel 的系统时,网络连接器显示 "Authentication Failed"。我设置了路由和所有内容,并在 Postman 中对其进行了测试,它确实 return:

SOAP-ENV:Client Bad Request: 6: No XML content to parse.

但是,我在本地服务器上收到了相同的消息。这是 QuickBooks WebConnector 日志文件:

20181129.22:33:07 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : updateWS() for application = 'QuickBooks Integrator' has STARTED
20181129.22:33:07 UTC   : UpdateThisScheduledApp() : Password management - Started
20181129.22:33:07 UTC   : UpdateThisScheduledApp() : Password management - Ended
20181129.22:33:07 UTC   : UpdateThisScheduledApp() : Performing SCHEDULED UPDATE for application = QuickBooks Integrator
20181129.22:33:07 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20181129.22:33:07 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20181129.22:33:07 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20181129.22:33:07 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20181129.22:33:07 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: QuickBooks Integrator
20181129.22:33:07 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): QuickBooks Integrator
20181129.22:33:07 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://7c24f463.ngrok.io/v2/financialhub/qbwc
20181129.22:33:07 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20181129.22:33:09 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : XML dump follows: -

Actual error received from web service for serverVersion call: <Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
The request failed with the error message:
--
<?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 /v2/financialhub/qbwc</ns1:serverVersionResult></ns1:serverVersionResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>
--.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-serverVersion.

20181129.22:33:09 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : This application does not contain support for serverVersion. Allowing update operation for backward compatibility.
20181129.22:33:09 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.2.0.94">
20181129.22:33:10 UTC   : QBWebConnector.SOAPWebService.updateWS() : XML dump follows: -

Actual error received from web service for clientVersion call: <Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
The request failed with the error message:
--
<?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:clientVersionResponse><ns1:clientVersionResult></ns1:clientVersionResult></ns1:clientVersionResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>
--.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-clientVersion.

20181129.22:33:10 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application does not contain support for clientVersion. Allowing update operation for backward compatibility.
20181129.22:33:10 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'QuickBooks Integrator', username = 'quickbooks'
20181129.22:33:10 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="quickbooks"><password=<MaskedForSecurity>
20181129.22:33:12 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : XML dump follows: -

QBWC1012: Authentication failed due to following error message.
Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
The request failed with the error message:
--
<?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:authenticateResponse><ns1:authenticateResult><ns1:string>7515a133a99e8bf659bc1bf77e368e37</ns1:string>
<ns1:string>none</ns1:string>
</ns1:authenticateResult></ns1:authenticateResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>
--.
More info:
StackTrace =    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at QBWebConnector.localhost.WCWebServiceDoc.authenticate(String strUserName, String strPassword)
   at QBWebConnector.localhost.WCWebService.authenticate(String strUserName, String strPassword)
   at QBWebConnector.SOAPWebService.authenticate(String UserName, String Password)
   at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = System.Web.Services

20181129.22:33:12 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20181129.22:33:12 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20181129.22:33:12 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : Update completed with errors. See log (QWClog.txt) for details.
20181129.22:33:12 UTC   : UpdateThisScheduledApp() : QBWC1031: Update completed with some error. Application has been notified of the error accordingly. See QWCLog for further information.
20181129.22:33:12 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20181129.22:33:12 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20181129.22:33:12 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20181129.22:33:12 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20181129.22:33:12 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: QuickBooks Integrator
20181129.22:33:12 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): QuickBooks Integrator
20181129.22:33:12 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://7c24f463.ngrok.io/v2/financialhub/qbwc
20181129.22:33:12 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20181129.22:33:14 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : XML dump follows: -

Actual error received from web service for serverVersion call: <Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
The request failed with the error message:
--
<?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 /v2/financialhub/qbwc</ns1:serverVersionResult></ns1:serverVersionResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>
--.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-serverVersion.

20181129.22:33:14 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : This application does not contain support for serverVersion. Allowing update operation for backward compatibility.
20181129.22:33:14 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.2.0.94">
20181129.22:33:15 UTC   : QBWebConnector.SOAPWebService.updateWS() : XML dump follows: -

Actual error received from web service for clientVersion call: <Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
The request failed with the error message:
--
<?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:clientVersionResponse><ns1:clientVersionResult></ns1:clientVersionResult></ns1:clientVersionResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>
--.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-clientVersion.

20181129.22:33:15 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application does not contain support for clientVersion. Allowing update operation for backward compatibility.
20181129.22:33:15 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'QuickBooks Integrator', username = 'quickbooks'
20181129.22:33:15 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="quickbooks"><password=<MaskedForSecurity>
20181129.22:33:16 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : XML dump follows: -

QBWC1012: Authentication failed due to following error message.
Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
The request failed with the error message:
--
<?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:authenticateResponse><ns1:authenticateResult><ns1:string>5d989f16c2eda5ca46f3157752b54893</ns1:string>
<ns1:string>none</ns1:string>
</ns1:authenticateResult></ns1:authenticateResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>
--.
More info:
StackTrace =    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at QBWebConnector.localhost.WCWebServiceDoc.authenticate(String strUserName, String strPassword)
   at QBWebConnector.localhost.WCWebService.authenticate(String strUserName, String strPassword)
   at QBWebConnector.SOAPWebService.authenticate(String UserName, String Password)
   at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = System.Web.Services

20181129.22:33:16 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20181129.22:33:16 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20181129.22:33:16 UTC   : QBWebConnector.WebServiceManager.DoUpdate() : Update completed with errors. See log (QWClog.txt) for details.

所有请求 return 200 HTTP 响应错误,我没有看到任何 PHP 错误。我将 error_reporting 设置为 E_ALL 和 E_STRICT;事实上,我基本上是逐字复制 example_web_connector.php 文件。

这是我的 SOAP 服务器所说的:

QuickBooks PHP DevKit Server v3.0 at /v2/financialhub/qbwc
   (c) "Keith Palmer" <keith@consolibyte.com> 
   Visit us at: http://www.ConsoliBYTE.com/ 

Use the QuickBooks Web Connector to access this SOAP server.

QuickBooks_WebConnector_Server::handle() parameters: 
 - $return = 1
 - $debug  = 1

Misc. information: 
 - Logging: 3
 - Timezone: America/Edmonton (Auto-set: )
 - Current Date/Time: 2018-11-29 15:44:52
 - Error Reporting: 32767

SOAP adapter: 
 - QuickBooks_Adapter_Server_Builtin

Registered handler functions: 
Array
(
    [0] => __construct
    [1] => authenticate
    [2] => sendRequestXML
    [3] => receiveResponseXML
    [4] => connectionError
    [5] => getLastError
    [6] => closeConnection
    [7] => serverVersion
    [8] => clientVersion
)

Detected input: 


Timestamp: 
 - 2018-11-29 15:44:52 -- process 0.07853

这个错误:

Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.

意味着 某事 正在发送 Content-Type: text/html header,并覆盖框架正在尝试的 Content-Type: text/xml header发送。

Laravel大概就是这样做的。尝试将 Laravel 中的 response/route 调整为 return text/xml

示例:

return response($contents)->header('Content-Type', 'text/xml');