Expand my Community achievements bar.

Structures not being passed to a CFC

Avatar

Level 1
Something has changed in the calls I make to my ColdFusion
datasources but I don’t know what. What I do know is that
these calls have worked for over 6 months and then quit working
recently, as in I noticed the problem this morning while I was
making a change for my customer. Problem is some of my database
calls still work while others don’t. It seems to be random
about which calls still work and which ones don’t. I have two
examples of code below, one which still works and one of which now
fails.



The problem seems to be in the structures I use to pass my
variables to my database web service. Basically I pass in a
structure of variables from Flex to my CFC. Below is an example of
the calls I am using to pass my variables to my CFC from inside my
Flex app:



private function
contactInfoAddedHandler(event:AddContactInfoEvent):void

{

addTmpData.modContactInfo(event.contactInfoToAdd);

}



private function
addrInfoAddedHandler(event:AddAddrInfoEvent):void

{

addTmpData.modAddrInfo(event.addrInfoToAdd);

}



Both of these calls use the exact same RemoteObject tag in my
Flex code too.



Both of these calls worked fine for months, now the top one
fails. The problem is how the data gets received by my CFC. In my
CFC’s I tell the app that is should expect a structure with
my variables to be passed in. This is the header code in my CFC for
both of these calls:



<cffunction name="modAddrInfo" access="remote"
returntype="string">

<cfargument name="AddrInfo" type="struct"
required="yes">

… database code…

</cffunction>



<cffunction name="modContactInfo" access="remote"
returntype="string">

<cfargument name="ContactInfo" type="struct"
required="yes">

… database code…

</cffunction>



Now for the problem… in the modContactInfo function the
CFC receives the data as a bunch of individual arguments instead of
a structure of elements. In the modAddrInfo function the CFC
receives one structure with all of the elements inside of the
structure. I have no idea why one function still gets the whole
structure and the other one gets every item inside the structure as
separate elements.



To fix the problem all I have to do is change my argument
calls inside the function from this:
“arguments.ContactInfo.CellPhoneNumber” to this”
“arguments.CellPhoneNumber”. But I don’t want to
do that… I would rather deal with one passed structure than a
whole slew of variables.



My question is why does one function still receive a
structure and the other a bunch of individual elements??? From the
Flex app both sets of data look the same, or in other words all
elements are properly contained within their respective event. Does
anybody have an idea as to what could cause this problem, or more
importantly how to fix it??? Oh, my client is using CF 7.02 and the
app is compiled using Flex 3.0 if that helps… Thanks in
advance for your insights…

0 Replies