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";
    creationComplete="TestService.getEmployees.send();">
    <mx:WebService id="TestService" 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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to