You said, "Flex shuts down hard", but then you said you DG is empty, so
persumabley is is displaying.  So Flex is not shutting down?

 

Yes, on valdhors suggestion to leave contentType at the default.

 

Also, you have not set the resultFormat="e4x" which means you are
working with a tree of dynamic objects.  This is rarely desirable.  I
advise working with e4x, XML, XMLList and XMLListCollection.  In some
cases, ther can be performance problems with these objects, and you
would need to move to generating an ArrayCollection of strongly typed
VOs.  But I advise going the XML route until you see a need to change.
The default resultFormat="object" is kinda the worst of both worlds, you
lose the e4x filter/selection functionality and still have the
performance hit of accessing dynamic objects.

 

Also, If I am reading your xml right, your expression would be correct
for e4x xml:

"checkJobs.lastResult.jobs.job" would return an XMLList of all of the
job nodes.

 

Finally, I advise using a result handler instead of binding directly to
lastResult.  Binding is hard to debug, and sooner or later you will need
to take some action when the result data arrives.  Hard to do that in a
binding.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of valdhor
Sent: Monday, May 19, 2008 4:34 PM
To: [email protected]
Subject: [flexcoders] Re: Grr, HTTPService doesn't work when it should

 

You have set the contentType property of your request to
"application/xml" and the sent an empty string as your request. Flex
(Probably) sees that and sends <> as the XML request. You probably
want to remove the contentType property of your request and let flex
use a contentType of "application/x-www-form-urlencoded" (The default).

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Clinton D. Judy" <[EMAIL PROTECTED]> wrote:
>
> I tried Charles, and discovered I was sending this to Rails:
> 
> 
> 
> <> 
> 
> 
> 
> This doesn't seem right, and sure enough, Rails is throwing errors
when
> it receives that. So it's gotta be my HTTPService, but I don't know
> where to begin fixing it.
> 
> 
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Clinton D. Judy
> Sent: Monday, May 19, 2008 4:13 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: RE: [flexcoders] Grr, HTTPService doesn't work when it should
> 
> 
> 
> I tried this, it didn't work. I thought you still referred to the
first
> element in an array in Flex, not its parent class. Are you sure my
> HTTPService is fine?
> 
> 
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Jeff Vroom
> Sent: Monday, May 19, 2008 3:59 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: RE: [flexcoders] Grr, HTTPService doesn't work when it should
> 
> 
> 
> I think at least you need to change:
> 
> 
> 
> checkJobs.lastResult.jobs.job
> 
> 
> 
> to:
> 
> 
> 
> checkJobs.lastResult.jobs
> 
> 
> 
> the DataGrid is expecting a list of jobs, not just a single job. 
> 
> 
> 
> Jeff
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Clinton D. Judy
> Sent: Monday, May 19, 2008 12:52 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Grr, HTTPService doesn't work when it should
> 
> 
> 
> This may be a simple problem, but Flex shuts down hard when I try this
> code:
> 
> 
> 
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> 
> <mx:Application
> 
> xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
> 
> layout="vertical" horizontalAlign="center" verticalAlign="top"
> 
> width="100%" height="100%" creationComplete="checkJobs.send()">
> 
> <mx:Script>
> 
> <![CDATA[
> 
> import mx.controls.Alert;
> 
> import mx.rpc.events.ResultEvent;
> 
> ]]>
> 
> </mx:Script>
> 
> <mx:HTTPService id="checkJobs"
> url="http://127.0.0.1:3001/jobs.xml <http://127.0.0.1:3001/jobs.xml> "
useProxy="false"
> contentType="application/xml" method="POST" />
> 
> <mx:DataGrid id="jobs" width="100%" height="60%"
> dataProvider="{checkJobs.lastResult.jobs.job}">
> 
> <mx:columns>
> 
> <mx:DataGridColumn headerText="Name" dataField="name"
> />
> 
> <mx:DataGridColumn headerText="ECMS" dataField="ecms"
> />
> 
> </mx:columns>
> 
> </mx:DataGrid>
> 
> <mx:Button label="check jobs" click="checkJobs.send()" />
> 
> </mx:Application>
> 
> 
> 
> 
> 
> And the accompanying XML file:
> 
> 
> 
> 
> 
> <jobs type="array">
> 
> <job>
> 
> <created-at type="datetime">2008-05-19T10:35:48-04:00</created-at>
> 
> <display-order type="integer" nil="true"/>
> 
> <ecms>1923</ecms>
> 
> <id type="integer">1</id>
> 
> <job-id nil="true"/>
> 
> <name>199238GAME</name>
> 
> <updated-at type="datetime">2008-05-19T10:35:48-04:00</updated-at>
> 
> </job>
> 
> <job>
> 
> <created-at type="datetime">2008-05-19T14:20:52-04:00</created-at>
> 
> <display-order type="integer" nil="true"/>
> 
> <ecms>1553</ecms>
> 
> <id type="integer">2</id>
> 
> <job-id nil="true"/>
> 
> <name>asdgggd</name>
> 
> <updated-at type="datetime">2008-05-19T14:20:52-04:00</updated-at>
> 
> </job>
> 
> </jobs>
> 
> 
> 
> 
> 
> Why isn't the datagrid being populated?
> 
> 
> 
> Clinton Judy
> 
> Web Developer
> 
> Glenn O. Hawbaker, Inc.
>

 

Reply via email to