我正在使用Consolibyte SDK。它在我的本地服务器(XAMPP)上运行良好,但是当我将其移动到公司基于Laravel的系统上时,Web连接器显示“身份验证失败”。我已经设置了路线并进行了所有操作,并在Postman中对其进行了测试,并且确实返回了:
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.
所有请求均返回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
答案 0 :(得分:0)
此错误:
Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.
表示某物正在发送Content-Type: text/html
标头,并覆盖框架尝试发送的Content-Type: text/xml
标头。
Laravel可能正在这样做。尝试在Laravel中调整您的响应/路线以返回text/xml
:
示例:
return response($contents)->header('Content-Type', 'text/xml');