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" を使用して、構造体から文字列を作成します

構造体を「シリアライズするだけ」と考えている方もいらっしゃると思います。まあ、Railoにはそのような機能はありません(私が知っていることです)。

どんなアイデアでも大歓迎です。

4

1 に答える 1

0

私が目にする最初の問題は、「認証」メソッドの戻り値の型が文字列であるが、配列を返していることです。文字列を返そうとする場合は、JSON 形式の文字列として返す retVal の代わりに return serializeJSON(loc.retVal) を使用できます。

于 2015-02-07T02:15:57.330 に答える