0

我正在尝试在 Railo 4.x 中实现 Quickbooks Web 连接器 (QBWC)

<cfcomponent  output="false">

<cffunction name = "authenticate" access="remote" returntype="string">
    <cfargument name = "username" type="string" required="true">
    <cfargument name = "password" type = "string" required="true">

    <cfset var loc = {}>

    <cfset loc.retVal= []>

    <cfset loc.retVal[1] = "MYSESSIONTOKEN">
    <cfset loc.retVal[2] = "NONE">
    <cfset loc.retVal[3] = "">
    <cfset loc.retVal[4] = "">


    <cfreturn loc.retVal >
</cffunction>

<cffunction name = "clientVersion" access="remote" returnType ="string">
    <cfargument name = "productVersion" type="string" required="true">

    <cfset var loc = {}>

    <cfset loc.retVal = "">

    <cfreturn loc.retVal>
</cffunction>



</cfcomponent>

这是我的 QWC 文件:

<?xml version="1.0"?>
<QBWCXML>
<AppName>QuickCellarSVC</AppName>
<AppID></AppID>
<AppURL>http://localhost:8080/QuickCellar.cfc</AppURL>
<AppDescription>Quick Cellar railo component</AppDescription>
<AppSupport>http://localhost:8080/support.cfm</AppSupport>
<UserName>Joe</UserName>
<OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D20}</OwnerID>
<FileID>{90A44FB5-33D9-4815-AC85-BC87A7E7D1EB}</FileID>
<QBType>QBFS</QBType>
<Scheduler>
<RunEveryNMinutes>2</RunEveryNMinutes>
</Scheduler>
</QBWCXML>

QBWC 跟踪显示了问题:

Object reference not set to an instance of an object.
More info:
StackTrace =    at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
Source = QBWebConnector

我能够进一步深入研究并发现Railo可能存在铸造问题?

<?xml version="1.0" encoding="UTF-8"?>
-<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">-<soap:Body>-

无法将复杂对象类型结构转换为字符串


使用内置函数 "serialize(Struct):String" 从 Struct 创建一个字符串

现在我知道你们中的一些人正在考虑“只是序列化”结构。好吧,Railo 中没有这样的功能(据我所知)。

任何想法都非常感谢。

4

1 回答 1

0

我看到的第一个问题是您的“身份验证”方法的返回类型为字符串,但您返回的是一个数组。如果您尝试返回一个字符串,您可以使用 return serializeJSON(loc.retVal) 而不仅仅是 retVal,后者会将其作为 JSON 格式的字符串返回。

于 2015-02-07T02:15:57.330 回答