R – How to convert WebService result typed as ObjectProxy to XML

actionscript-3apache-flexweb servicesxml

I have a WebService that returns XML in a SOAP response:

<?xml version="1.0" encoding="utf-8" ?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <GetConfigResponse xmlns="Web.Services">
            <GetConfigResult>
                <Configuration xmlns="">
                    <Stuff>False</Stuff> 
                    <MoreStuff>
                        <Report_Format>PDF</Report_Format> 
                        <Report_Sections>
                            <Report_Section>
                                <idNmb>1</idNmb> 
                                <name>Report 1</name> 
                                <isDefault>true</isDefault> 
                                <isVisible>true</isVisible> 
                            </Report_Section>
                            <Report_Section>
                                <idNmb>2</idNmb> 
                                <name>Report 2</name> 
                                <isDefault>false</isDefault> 
                                <isVisible>true</isVisible> 
                            </Report_Section>
                        </Report_Sections>
                    </MoreStuff>
                </Configuration>
            </GetConfigResult>
        </GetConfigResponse>
    </soap:Body>
</soap:Envelope>

When I call this WebService the Flex debugger shows the type of the ResultEvent.result is "ObjectProxy". When I try to cast this value as XML, it traces as "[object Object]", and I cannot access the XML nodes. For most other WebServices I call, the ResultEvent.result is of type "Array", and converts to XML with no problem.

What can I do to store this result as XML?

Best Answer

Set the resultFormat of your request/operation to "e4x" and it will return an XML object instead of converting the result to an ObjectProxy.