0

I am attempting to implement a Quickbooks Web connector (QBWC) in Railo 4.x

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

This is my QWC file:

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

The QBWC trace shows the problem :

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

I was able to drill down a little more and discover that there is a casting problem in Railo maybe?

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

Can't cast Complex Object Type Struct to String


Use Built-In-Function "serialize(Struct):String" to create a String from Struct

Now I know some of you are thinking "just serialize" the struct. Well, there is no such function in Railo (that I know of).

Any ideas are greatly appreciated.

1 Answers1

0

The first issue I see is your "authenticate" method has return type of string, but you are returning an array. If you are trying to return a string you could use return serializeJSON(loc.retVal) instead of just retVal, which would return it as a JSON formatted string.

RobZ
  • 71
  • 2