I’m not sure who is to blame, but this really smells like a bug to me. I’m getting into the habit of creating an object in Flex if I’m sending a lot of fields to a CFC. It shortens up the RemoteObject call and makes debugging easier because then all the data to be passed is in a single structure.
So I have this harmless looking bit of code. Make an object, figure out the value of some Boolean, and call a method in my RemoteObject.
var deptInfo:Object = new Object();
var newDept:Boolean = chNewDept.selected ? true : false;
deptInfo = {
DepartmentID : cbEditDept.selectedItem.DepartmentID,
Department : tiEditDeptName.text,
Division : cbEditDivision.selectedItem.Division,
newDept : newDept};
ro.saveDepartment(deptInfo);
Simple enough. The function it’s calling is simple too. Take the data and mangle it with queries and whatever.
<cffunction name="saveDepartment">
<cfargument name="deptInfo" type="struct" required="true">
...
</cffunction>
Cool, let’s run it…
coldfusion.runtime.MissingArgumentException: The parameter DEPTINFO to function saveDepartment is required but was not passed in.
AHH! What? Everything I tried in Flex, that object wasn’t ending up in the arguments scope of the ColdFusion function. I set the access to remote and called the function through the URL, it works fine. I tried a cfinvoke from ColdFusion…
<cfset deptInfo = StructNew()>
<cfset deptInfo["DepartmentID"] = 1>
<cfset deptInfo["Department"] = "testdept">
<cfset deptInfo["Division"] = "testdiv">
<cfset deptInfo["newDept"] = true>
<cfinvoke component="kiosc.cfc.disc" method="saveDepartment" deptInfo="#deptInfo#"/>
And it works fine. So what’s wrong with this running from Flex? I checked with ServiceCapture, that shows the object’s data being passed properly over the wire. I got the bright idea to pass another, dummy, variable along with my structure.
ro.saveDepartment(deptInfo,1);
And that works. So tell me, what the hell. Searching Google came up with nothing, implying no one else is having this problem. I have another application that does this same thing, making an object and passing it to the CFC, and that worked fine. But that one is sending the object and 2 arrays. This one that didn’t work is only passing the object. Is there some bug with only passing a single object to a CFC?
Recent Comments