Hi Folks, I'm using a CFC as a proxy for Flash remoting calls to Google Adwords API. I've found that the Google SOAP services choke on complex object types and Arrays sent from Flash unless I rebuild those objects in the CFC before invoking the Google webservice (despite the fact CF has no trouble with the datatypes!).
So, I'm trying to write a couple of recursive methods for the CFC that I can use to sanitise these Flash datatypes for the webservice. Having trouble getting it working though as I'm far more comfortable with Actionscript than CF. On top of which I am sure there is a much more elegant way to handle this. I'd really appreciate if anyone out there could take a quick look over my attempts at recursion and tell me where I'm going wrong. Right now using these functions I am getting unwanted duplicate nested structs and arrays. Thanks for any guidance, Clark <!-- Method to sanitise Flash Arrays for Google adwords API webservice --> <cffunction name="sanitiseFlashArray" access="private" returnType="any"> <cfargument name="flashArr" type="array" required="yes"> <cfset newArr = Arraynew(1)> <cfloop index="i" from="1" to="#Arraylen(flashArr)#"> <cfset tmpItem = #flashArr[i]#> <cfif IsArray(tmpItem)> <cfinvoke method="sanitiseFlashArray" flashArr="#tmpItem#" returnvariable="newItem"> <cfset #newArr[i]# = #newItem#> <cfelseif IsStruct (tmpItem)> <cfinvoke method="sanitiseFlashObject" flashArr="#tmpItem#" returnvariable="newItem"> <cfset #newArr[i]# = #newItem#> <cfelse> <cfset #newArr[i]# = #tmpItem#> </cfif> </cfloop> <cfreturn "#newArr#"> </cffunction> <!-- Method to sanitise Flash Objects for Google adwords API webservice --> <cffunction name="sanitiseFlashObject" access="private" returnType="any"> <cfargument name="flashObj" type="struct" required="yes"> <cfset newObj = StructNew()> <cfloop collection="#flashObj#" item="key"> <cfset tmpItem = #flashObj[key]#> <cfif IsStruct(tmpItem)> <cfinvoke method="sanitiseFlashObject" flashArr="#tmpItem#" returnvariable="newItem"> <cfset #newObj[key]# = #newItem#> <cfelseif IsArray (tmpItem)> <cfinvoke method="sanitiseFlashArray" flashArr="#tmpItem#" returnvariable="newItem"> <cfset #newObj[key]# = #newItem#> <cfelse> <cfset #newObj[key]# = #tmpItem#> </cfif> </cfloop> <cfreturn "#newObj#"> </cffunction> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219297 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

