Avatar

Level 2
Hi

I've got a problem sending objects between Flex and
Coldfusion using the AMF Gateway of the newest Coldfusion Version.

The transfer from CFC to Flex does work, but I can't send a
complex object to a CFC.



The error Message is:

faultCode:Client.Message.Encoding faultString:'Cannot create
class of type 'flex.HotlineSystem.bin.cf.Category'.'
faultDetail:'Type 'flex.HotlineSystem.bin.cf.Category' not found.'



Im totally going nuts ... the transfer from CF to Flex is
working fine, the mapping between category.cfc and category.as ist
working. But If I try to send an category Object from Flex to my
CFC it is not.



Hope someone can help.



Merci!



CFC Function:

<cffunction name="insertCategory" access="public"
returntype="void" output="false">

<cfargument name="category"
type="flex.HotlineSystem.bin.cf.Category" required="true">



<cfquery name="insertCategory"
datasource="hotline_system">

INSERT INTO category (category_idCategory, name)

VALUES ( #category.getCategory_IdCategory()#,
'#trim(category.getName())#')

</cfquery>





category.cfc:



<cfcomponent displayname="Category"
alias="flex.HotlineSystem.bin.cf.Category" hint="I model a single
Category">

<cfproperty name="idCategory" type="numeric"
default="0">

<cfproperty name="category_idCategory" type="numeric"
default="0">

<cfproperty name="name" type="string" default="">



<cfscript>

//Initialize the CFC with the default properties values.

variables.idCategory = 0;

variables.category_idCategory = 0;

variables.name = "";

</cfscript>



<cffunction name="init" output="false"
returntype="flex.HotlineSystem.bin.cf.Category">

<cfreturn this>

</cffunction>



<cffunction name="getIdCategory" output="false"
access="public" returntype="any">

<cfreturn variables.IdCategory>

</cffunction>



<cffunction name="setIdCategory" output="false"
access="public" returntype="void">

<cfargument name="val" required="true">

<cfif (IsNumeric(arguments.val)) OR (arguments.val EQ
"")>

<cfset variables.IdCategory = arguments.val>

<cfelse>

<cfthrow message="'#arguments.val#' is not a valid
numeric"/>

</cfif>

</cffunction>



<cffunction name="getCategory_idCategory" output="false"
access="public" returntype="any">

<cfreturn variables.Category_idCategory>

</cffunction>



<cffunction name="setCategory_idCategory" output="false"
access="public" returntype="void">

<cfargument name="val" required="true">

<cfif (IsNumeric(arguments.val)) OR (arguments.val EQ
"")>

<cfset variables.Category_idCategory = arguments.val>

<cfelse>

<cfthrow message="'#arguments.val#' is not a valid
numeric"/>

</cfif>

</cffunction>



<cffunction name="getName" output="false" access="public"
returntype="any">

<cfreturn variables.Name>

</cffunction>



<cffunction name="setName" output="false" access="public"
returntype="void">

<cfargument name="val" required="true">

<cfset variables.Name = arguments.val>

</cffunction>

</cfcomponent>



category.as:



package classes

{

[Bindable]

[RemoteClass(alias="flex.HotlineSystem.bin.cf.Category")]

public dynamic class category

{

public var idCategory:int;

public var category_idCategory:int;

public var name:String;



public function category(){



}



public function fill(idCategory:int,
category_idCategory:int, name:String):void{

this.idCategory = idCategory;

this.category_idCategory = category_idCategory;

this.name = name;

}





public function getIdCategory():int{

return this.idCategory;

}



public function setIdCategory():void{

this.idCategory = idCategory;

}



public function getCategory_IdCategory():int{

return this.category_idCategory;

}



public function
setCategory_IdCategory(category_idCategory:int):void{

this.category_idCategory = category_idCategory;

}



public function setName(name:String):void{

this.name = name;

}



public function getName():String{

return this.name;

}

}

}