JJSAM
08-13-2008, 09:46 PM
Hi All,
In my CFC I'm trying to get data from the server into my flex app.
<cfcomponent displayname="GapTR.cfc" hint="CFC controls all things Gap Report" output="false">
<cffunction name="getBuyType" access="remote" returntype="xml" output="false">
<cfset var BuyTypeQRY = "">
<cfset var BuyTypeXML = "">
<cfset var parsedBuyTypeXML = "">
<cfquery name="BuyTypeQRY" datasource="gmpwMaster">
SELECT DISTINCT Buy_Type
FROM perseus_AdAssignment
ORDER BY Buy_Type
</cfquery>
<cfset toXML = createObject("component","toXML")>
<cfset BuyTypeXML = toXML.queryToXML(BuyTypeQRY,"dataset","row")>
<cfset parsedBuyTypeXML = xmlParse(BuyTypeXML)>
<cfcontent type="application/xml; charset=UTF-8">
<cfreturn parsedBuyTypeXML />
</cffunction>
</cfcomponent>
and calling this cfc file in mxml....
<mx:Script>
<![CDATA[
[Bindable] public var xmlBuyType:XML;
private function initGap():void {
cfGap.getBuyType();
}
private function saveGap():void {
var BuyType:String;
if( cbBuyType.selectedItem.toString()==''){
Alert.show("Buy Type Unvalid Type")
}
else {
BuyType = cbBuyType.selectedItem.toString();
}
}
public function resultBuyType(event:ResultEvent):void {
xmlBuyType = new XML(event.result);
}
]]>
</mx:Script>
<!--Database Server Connection -->
<mx:RemoteObject id="cfGap" destination="ColdFusion" source="TDB.CFCs.GapTR" showBusyCursor="true">
<mx:method name="getBuyType" result="resultBuyType(event)" fault="Alert.show(event.fault.message)"/>
</mx:RemoteObject>
<mx:Label x="30" y="34" text="Buy Type" id="lblBuyType_cb" fontSize="12" fontWeight="bold"/>
<mx:ComboBox x="10" y="60" width="110" id="cbBuyType" dataProvider="{xmlBuyType.row.Buy_Type}"></mx:ComboBox>
when I run it, I get the following error:
faultCode:Server.Processing faultString:'Could not find the ColdFusion Component toXML.' faultDetail:'Please check that the given name is correct and that the component exists.'
Any Idea why...
In my CFC I'm trying to get data from the server into my flex app.
<cfcomponent displayname="GapTR.cfc" hint="CFC controls all things Gap Report" output="false">
<cffunction name="getBuyType" access="remote" returntype="xml" output="false">
<cfset var BuyTypeQRY = "">
<cfset var BuyTypeXML = "">
<cfset var parsedBuyTypeXML = "">
<cfquery name="BuyTypeQRY" datasource="gmpwMaster">
SELECT DISTINCT Buy_Type
FROM perseus_AdAssignment
ORDER BY Buy_Type
</cfquery>
<cfset toXML = createObject("component","toXML")>
<cfset BuyTypeXML = toXML.queryToXML(BuyTypeQRY,"dataset","row")>
<cfset parsedBuyTypeXML = xmlParse(BuyTypeXML)>
<cfcontent type="application/xml; charset=UTF-8">
<cfreturn parsedBuyTypeXML />
</cffunction>
</cfcomponent>
and calling this cfc file in mxml....
<mx:Script>
<![CDATA[
[Bindable] public var xmlBuyType:XML;
private function initGap():void {
cfGap.getBuyType();
}
private function saveGap():void {
var BuyType:String;
if( cbBuyType.selectedItem.toString()==''){
Alert.show("Buy Type Unvalid Type")
}
else {
BuyType = cbBuyType.selectedItem.toString();
}
}
public function resultBuyType(event:ResultEvent):void {
xmlBuyType = new XML(event.result);
}
]]>
</mx:Script>
<!--Database Server Connection -->
<mx:RemoteObject id="cfGap" destination="ColdFusion" source="TDB.CFCs.GapTR" showBusyCursor="true">
<mx:method name="getBuyType" result="resultBuyType(event)" fault="Alert.show(event.fault.message)"/>
</mx:RemoteObject>
<mx:Label x="30" y="34" text="Buy Type" id="lblBuyType_cb" fontSize="12" fontWeight="bold"/>
<mx:ComboBox x="10" y="60" width="110" id="cbBuyType" dataProvider="{xmlBuyType.row.Buy_Type}"></mx:ComboBox>
when I run it, I get the following error:
faultCode:Server.Processing faultString:'Could not find the ColdFusion Component toXML.' faultDetail:'Please check that the given name is correct and that the component exists.'
Any Idea why...