首页 > 解决方案 > QuickBooks Web 连接器身份验证失败

问题描述

我正在使用 Consolibyte 的用于 Quick Books 的 PHP 开发工具包,并且我有一个安装了 Quick Books 的 VM 以及用于 Quick Books 的 Web 连接器。我能够成功地将我的 SOAP 服务添加到 Web 连接器,但是每次我请求它进行更新时,我都会收到身份验证失败并显示以下消息:

The request failed with an empty response.
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

我应该从哪里获取有关原因的更多信息?

看起来我已经克服了最初的错误,但现在我收到了无效的用户名或密码响应。

ns1:authenticateResponse Invalid username or password, try again.

QuickBooks 表的用户名和密码直接来自示例,这就是我在 Web 连接器中使用的。哪里是放置一些日志记录的好地方,这样我就可以理解为什么框架无法通过身份验证?

下面是一个日志文件:

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:
--
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>
		Phoenix Courier:
		QuickBooks	</title>
	<link href="/favicon.ico" type="image/x-icon" rel="icon"/><link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
	<link rel="stylesheet" href="/font/fa/master.css"/>	<link rel="stylesheet" href="/font/open-sans/styles.css"/>	<link rel="stylesheet" href="/font/open-sans-condensed/styles.css"/>	<link rel="stylesheet" href="/font/oswald/styles.css"/>
	<link rel="stylesheet" href="/css/base.css"/>	<link rel="stylesheet" href="/css/style.css"/>	<link rel="stylesheet" href="/css/phoenix.css"/>
				<script src="/js/jquery-3.3.1.min.js"></script>    
	<script src="/js/psUserInterface.js"></script></head>
<body>
	<div class="page-wrap">
				<div class="container clearfix">
			<?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>67481fd9-4703-fae4-6d81-0ccbf770b4fa</ns1:string>
<ns1:string></ns1:string>
</ns1:authenticateResult></ns1:authenticateResponse>
			</SOAP-ENV:Body>
			</SOAP-ENV:Envelope>		</div>
	</div>

<script>
PS_UI.navigation.initNavActive();
PS_UI.navigation.desktop.initNavArrows();
</script>
</body>
</html>

--.
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

这是我的 QWC 文件:

<?xml version="1.0"?>
<QBWCXML>
	<AppName>My QuickBooks SOAP Server</AppName>
	<AppID></AppID>
	<AppURL>https://dispatch.sharp.com/</AppURL>
	<AppDescription>An example QuickBooks SOAP Server</AppDescription>
	<AppSupport>https://dispatch.phoenixcourier.com/</AppSupport>
	<UserName>quickbooks</UserName>
	<OwnerID>{57F3B9B6-86F1-4FCC-B1FF-166DE1813D20}</OwnerID>
	<FileID>{57F3B9B6-86F1-4FCC-B1FF-966DE1813D20}</FileID>
	<QBType>QBFS</QBType>
	<Notify>false</Notify>
	<Scheduler>
		<RunEveryNMinutes>10</RunEveryNMinutes>
	</Scheduler>
	<IsReadOnly>false</IsReadOnly>
</QBWCXML>

标签: phpquickbooks

解决方案


我能够让它工作。它基本上是我在研究中发现的内容标题。我正在使用蛋糕框架。我做了以下测试。

$this->RequestHandler->respondAs('text/xml');


推荐阅读