Do a trace in the result handler, using mx.utils.ObjectUtil
public function handleQueryResult(event:ResultEvent):void{
trace(mx.utils.ObjectUtil.toString(event.result));
}
run in debug mode.
If I had to guess:
You're probably returning a cfquery from a DB.
If so, when accessing a cfc as WebService, query row field names are returned
in Uppercase.
Don't return cfquery's, but Array of Objects (structs) from cfc's.
Loop through the query and assign each field to a Struct and store each Struct
in an Array.
When setting each field, use Array access notation (see below):
<cfset tmpObj["fieldNameWithMixedCase"] = fieldNameWithMixedCase />
It's a pain, but will hopefully get fixed in the next CF release.
regards,
Muzak
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, March 07, 2007 1:50 AM
Subject: [flexcoders] exposing CFC's as web services
> I'm new to flex development and I'm just trying to do a simple data pull from
> a cfc using a web service.
>
> Query Result Function..
> public function handleQueryResult(event:ResultEvent):void{
> qResult=event.result as ArrayCollection;
> }
>
> Web Service..
> <mx:WebService id="myService" wsdl="http://localhost/HelloWorld.cfc?WSDL"
> useProxy="false">
> <mx:operation name="getData" result="handleQueryResult(event);"
> fault="Alert.show(event.fault.message)">
> </mx:operation>
> </mx:WebService>
>
> Data Grid..
> <mx:DataGrid dataProvider="{qResult}" width="668" height="376" x="20" y="240">
>
> Button...
> <mx:Button label="get projects" click="myService.getProjects()" x="377"
> y="199"/>
>
>
> I can get this to work fine if I use mx:RemoteObject...
> <mx:RemoteObject
> id="myService"
> destination="ColdFusion"
> source="CFC.HelloWorld"
> showBusyCursor="true"
> >
>
> But I'm using MX 6 so I need to use a webservice(right?)
>
> Anyhow.. any help w/ this would be appreciated.
>
> Thanks!
> -Jason
>