Title:
Inconsistent Results when using Struct Functions on data returned by a CF Web Service.
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Michael Imig / Michael Imig (mimig1)
Created: 09/21/2012
Components: Web Services
Versions: 10.0
Failure Type: Usability Issue
Found In Build/Fixed In Build: Final / 283243
Priority/Frequency: Major / All users will encounter
Locale/System: English / Win All
Vote Count: 0
Problem Description: When working with a struct returned by a web service, the list of keys returned by StructKeyList does not corrrelate with the results returned for each key by StructKeyExists. For example, the StructkeyList may show a key as existing, but StructKeyExists will return NO. Attempting to access the value under this key results in an error. A dump shows the key as existing, but having a value of "undefined"
Steps to Reproduce:
Create the following function in a CFC to be used as a webservice.
<cffunction name="getTest" output="no" returntype="struct" access="remote">
<cfargument name="appname" type="string" />
<cfset result=structnew()>
<cfset result.access = "public">
<cfset result.timestamp = "time">
<cfset result.parent = 1>
<cfset result.fuseactions = ArrayNew(1)>
<cfreturn result>
</cffunction>
Now invoke the web service on some page
<cfinvoke
webservice="http://servername/xxx.cfc?wsdl"
returnvariable = "response"
refreshWSDL = "true"
appname = "tester"
method="gettest"
/>
<cfdump var="#response#">
<cfdump var="#structKeyList(response)#">
<cfdump var="#structkeyExists(response,'FUSEACTIONS')#">
Actual Result:
Structkeylist shows the FUSEACTIONS key as existing, as does a dump, but attempts to access the key result in an error. StructKeyExists returns NO.
Expected Result:
StructKeyExists should return YES. A dump of the Struct should show an empty array, and not UNDEFINED.
Any Workarounds:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3334756
Deployment Phase: Release Candidate
External Customer Info:
External Company:
External Customer Name: mimig1
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: