e4x is the acronym for ECMA Script 4 XML, or something like that.  When
you specify it as the resultFormat for an RPC data service call, it
means that your result object will be an XML object and that you can use
the new, Actionscript 3 xml selection expressions with it.  If you do
NOT specify it explicitly, the resultFormat is object, which means that
your result data is converted int a nested mx:Object structure.  This is
significant to your question because it affects how you will examine the
result object.  Also, the default object conversion seems to simplify
namespace issues, but I find it harder to work with than e4x xml.

 

First, set up a result handler function.  You can do this on the service
level of for individual operations.  I'll show one on the tag. In the
Tag, set the function name:

<mx:WebService id="get_home_list" result="onResult(event)" ...>

 

And the function declaration:

  private function onResult(oEvent:ResultEvent):void

  {

 

oEvent is an object containing your result data.  What that object
contains first depends on the resultFormat you have specified for the
WebService or the operation, as discussed above.

 

If you are using the default, try:

    trace(ObjectUtil.toString(oEvent.result))

 

if you are using e4x xml, then try:

    trace( XML(oEvent.result).toXMLString() )

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of fgwenger
Sent: Tuesday, January 02, 2007 5:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Examining web service results structure

 


I'm not sure what e4x is. Here is my webservice declaration. It
returns a query from a ColdFusion web service (Flex=ArrayCollection, I
think).

<mx:WebService id="get_home_list" 
wsdl="http://imd9.state.or.us/ex/bcd/loisflex/lois.cfc?WSDL
<http://imd9.state.or.us/ex/bcd/loisflex/lois.cfc?WSDL> "
useProxy="false" showBusyCursor="true" >
<mx:operation name="qry_get_home_list">
<mx:request>
<q_home_id>0</q_home_id>
</mx:request>
</mx:operation>
</mx:WebService>

Thanks.

Fred

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Sure. Are you using e4x? Post your WebService tag declaration.
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Ben Marchbanks
> Sent: Tuesday, January 02, 2007 2:30 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: Re: [flexcoders] Examining web service results structure
> 
> 
> 
> Hey Tracy,
> 
> Can you elaborate more on exactly how you would do 
> this ? sample snippet.....
> 
> You gave me the same advice in my attempt to count 
> the records returned from a request.
> 
> Thanks
> 
> Ben Marchbanks
> 
> Tracy Spratt wrote:
> > Don't bind directly to lastResult. Instead, use a result handler
> > function, to which you have passed the event object. In that
fuction,
> > you can examine event.result at will.
> > 
> > 
> > 
> > If you are using resultFormat="e4x", use toXMLString(). If you are
> using
> > the default object resultFormat, then you need to find out how to
dump
> > the object.
> > 
> > 
> > 
> > Tracy
> > 
> > 
> > 
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of fgwenger
> > Sent: Tuesday, January 02, 2007 1:37 PM
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Examining web service results structure
> > 
> > 
> > 
> > I wondered if there was a way in Flex debug or somewhere in Flex to
> > see how it sees the object returned from a web service call. I am
> > consuming a web service that I don't have control of and it is
sending
> > back some structure. I can't tell what it looks like to Flex, so I
> > can't get the DataGrid's DataProvider path correct, e.g.
> > MyWS.MyMethod.LastResult.... then what?
> > 
> > Thanks.
> > 
> > 
> > 
> >
>

 

Reply via email to