Darren,

You are using a tree according to the example in  your post.  Or have you changed your question?

 

At any rate, binding is very difficult to debug.  I advise using a handler function in which you can use toXMLString() on the event.result object.

 

Then work your way down through the hierarchy a step at a time.

 

When you get the _expression_ that works you can put it in the binding _expression_.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of Darren Houle
Sent: Wednesday, August 23, 2006 1:30 PM
To: [email protected]
Subject: RE: [flexcoders] How to cast a WebService lastResult when CFC returnType="xml"

 

Peter,

Thanks! But I'm not using the results in a Tree or Grid, which seem to have
some magical parsing happening inside for you. I just want to do something
as simple as pulling a node value out of the incoming SOAP wrapped XML and
using it in, say, a TextArea. But... the following doesn't work...

<mx:TextArea
text="{MyService.myOperation.lastResult.people.person.firstname}" />

nor does

MyService.myOperation.lastResult.people.person[0].firstname
MyService.myOperation.lastResult.person.firstname
MyService.myOperation.lastResult.person[0].firstname

or any other pattern I've tried. Amy suggested referencing the path all the
way from the root node of the SOAP packet itself and treating the entire
SOAP message as a bix XML result, instead of just the node path of the
result. Something like...

MyService.myOperation.lastResult.myOperationResult.people.person.firstname

but I couldn't get that to work either.

Darren

>From: "Peter Watson" <[EMAIL PROTECTED]com>
>Reply-To: [EMAIL PROTECTED]ups.com
>To: <[EMAIL PROTECTED]ups.com>
>Subject: RE: [flexcoders] How to cast a WebService lastResult when CFC
>returnType="xml"
>Date: Wed, 23 Aug 2006 07:29:48 -0700
>
>Darren,
>
>If your XML nodes have attributes (ie. <node label="foo"></node>) - you
>can use the 'labelField' attribute to control the labels.
>
> <mx:Tree id="myTree" labelField="@label"/>
>
>If they don't (ie. <foo>bar</foo>) - or if you want to do any sort of
>custom label logic, you need to use the 'labelFunction' attribute to set
>the values appropriately.
>
><mx:Tree id="myTree2 labelFunction="myLabelFunc"/>
>
> public function myLabelFunc (item:XML):String{
>
> //if node has children
>
> if(item.children().toString() !=
>''){
>
> return item.name();
>
> }
>
> //no children, it's a leaf so get
>the value
>
> else{
>
> return
>item.toXMLString();
>
> }
>
> }
>
>
>
>
>
>regards,
>
>peter
>
>
>
>
>
>________________________________
>
>From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
>Behalf Of Darren Houle
>Sent: Monday, August 21, 2006 4:33 PM
>To: [EMAIL PROTECTED]ups.com
>Subject: RE: [flexcoders] How to cast a WebService lastResult when CFC
>returnType="xml"
>
>
>
>Bump??
>
>Darren
>
> >From: "Darren Houle" <[EMAIL PROTECTED]com <mailto:lokka_%40hotmail.com>
> >
> >Reply-To: [EMAIL PROTECTED]ups.com
><mailto:flexcoders%40yahoogroups.com>
> >To: [EMAIL PROTECTED]ups.com <mailto:flexcoders%40yahoogroups.com>
> >Subject: [flexcoders] How to cast a WebService lastResult when CFC
> >returnType="xml"
> >Date: Fri, 18 Aug 2006 23:08:44 -0400
> >
> >I have a ColdFusion Component (web service) that looks like...
> >
> ><cffunction name="getEmployees" access="remote" output="false"
> >returntype="xml">
> > <cfxml variable="myxml">
> > <people>
> > <person>
> > <firstname>John</firstname>
> > <lastname>Smith</lastname>
> > <job>
> > <title>Doctor</title>
> > <description>blah blah blah</description>
> > </job>
> > </person>
> > <person>
> > <firstname>Jane</firstname>
> > <lastname>Doe</lastname>
> > <job>
> > <title>Lawyer</title>
> > <description>blah blah blah</description>
> > </job>
> > </person>
> > </people>
> > </cfxml>
> > <cfreturn myxml>
> ></cffunction>
> >
> >and some Flex code that looks like...
> >
> ><?xml version="1.0" encoding="utf-8"?>
> ><mx:Application
> > xmlns:mx="http://www.adobe.com/2006/mxml
><http://www.adobe.com/2006/mxml> "
> > creationComplete="TestService.getEmployees.send();">
> > <mx:WebService id="TestService" wsdl="http://localhost/hr.cfc?wsdl
><http://localhost/hr.cfc?wsdl> ">
> > <mx:operation name="getEmployees" />
> > </mx:WebService>
> > <mx:Tree
> > id="myTree"
> > width="50%"
> > height="50%"
> > showRoot="false"
> > dataProvider="{TestService.getEmployees.lastResult}"/>
> ></mx:Application>
> >
> >But what I get is a Tree that looks like:
> >
> >Flex doesn't seem to be able to extract the XML from the SOAP message,
> >which
> >is just SOAP XML wrapping my XML data.
> >
> >Changing the Operation's resultFormat from "e4x" to "xml" to "object"
> >changes the amount of junk in the Tree, but doesn't fix the problem. As
>a
> >matter of fact, it works best when I leave off this attribute and let
>the
> >Operation decide what resultFormat to use.
> >
> >Casting lastResult as XML or XMLList doesn't seem to help either, and
> >neither does
> >ArrayUtil.toArray(TestService.getEmployee.lastResult)
> >
> >Is there something I need to do to the lastResult to get it to work in
> >Trees, DataGrids, etc? Like cast it as some other data type? Why
>doesn't
> >e4x parse the SOAP message properly and extract my XML?
> >
> >Just about every example I can find out there shows people using
> >HTTPService
> >to pull back just the XML data without the SOAP webservice stuff, or
>else
> >shows how to create XML inside the mxml code itself using <mx:XML> but
>I
> >can
> >find nothing that shows how to return XML from a CFC web service and
> >use/parse it in Flex properly (as easy as, say, a CFC that returns a
>Query
> >object.)
> >
> >Darren

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to