I am trying to get my test app to work with remoteobjects, but thus
far I have been sol. I am using a simple tutorial I found online, but
I keep getting this error.

faultCode:InvokeFailed faultString:'[MessagingError message='Unknown
destination 'ColdFusion'.']' faultDetail:'Couldn't establish a
connection to 'ColdFusion''

I have checked my services-config.xml and it seems to be fine. Below
is code from the tutorial and my services-config.xml. Does anyone see
anything wrong here?


test.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
        xmlns:mx="http://www.adobe.com/2006/mxml"; 
        xmlns:comp="components.*"
        layout="absolute"
        creationComplete="initApp()">
        
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        import mx.rpc.Fault;
                        import mx.rpc.events.FaultEvent;
                        import mx.rpc.events.ResultEvent;
                        import mx.rpc.soap.mxml.WebService;                     
                        
            import mx.events.ValidationResultEvent;
            
            private var vResult:ValidationResultEvent;
                        
                        public function initApp():void {
                        }
                        
                        public function 
handleFormResult(event:ResultEvent):void {
                                Alert.show("Your Book Has Been Submitted!");
                        }
                        
                        public function 
handleRemotingResult(event:ResultEvent):void {
                                Alert.show("Remoting Result Received!");
                                qryDG_dg.dataProvider = event.result;
                        }
                        
                        public function 
handleWebServiceResult(event:ResultEvent):void {
                                Alert.show("Webservice Result Received!");
                                wsdlDG01_dg.dataProvider = event.result;
                        }
                        
                        public function errorHandler(event:FaultEvent):void {
                                Alert.show(event.fault.message);
                                error.text = event.fault.message;               
                
                        }
                        
                        public function submitBook():void {
                                var validFlag:Boolean = true;
                            var authorResult:ValidationResultEvent = 
authorV.validate();
                            var titleResult:ValidationResultEvent = 
titleV.validate();
                            var genreResult:ValidationResultEvent = 
genreV.validate();
                            var linkResult:ValidationResultEvent = 
linkV.validate();
                            
                                if (authorResult.type == 
ValidationResultEvent.INVALID) {
                                        validFlag = false;
                                        Alert.show("Author Name must be four or 
more characters and no
less than 1 character.");
                                }
                            
                                if (titleResult.type == 
ValidationResultEvent.INVALID) {
                                        validFlag = false;
                                        Alert.show("Title is required.");
                                }
                            
                                if (genreResult.type == 
ValidationResultEvent.INVALID) {
                                        validFlag = false;
                                        Alert.show("Genre is required and 
cannot be less than three
characters.");
                                }
                        
                                if (linkResult.type == 
ValidationResultEvent.INVALID) {
                                        validFlag = false;
                                        Alert.show("Link is required and cannot 
be less than three
characters.");
                                }
                                
                                if (validFlag)
                                        insertBookService.addBook.send();
                        }
                ]]>
        </mx:Script>
        
        <mx:RemoteObject
                id="qryService" 
                destination="ColdFusion"
                source="remotingExample" 
                result="handleRemotingResult(event)" 
                showBusyCursor="true" 
                fault="errorHandler(event)"/>
        
        <mx:WebService
                id="insertBookService" 
                wsdl="http://localhost:8500/remotingExample.cfc?wsdl";
                result="handleFormResult(event)" 
                showBusyCursor="true" 
                fault="errorHandler(event)">
                        <mx:operation name="addBook">
                                <mx:request>
                                    <bookAuthor>{bookAuthor.text}</bookAuthor>
                                    <bookTitle>{bookTitle.text}</bookTitle>
                                    <bookGenre>{bookGenre.text}</bookGenre>
                                    <bookLink>{bookLink.text}</bookLink>
                                </mx:request>
                        </mx:operation>
        </mx:WebService>
                
        <mx:WebService 
                id="wsdlQryService"
                useProxy="false"
                wsdl="http://localhost:8500/remotingExample.cfc?wsdl";>
                <mx:operation 
                        name="getAllBooks" 
                        result="handleWebServiceResult(event)"
                        fault="errorHandler(event)"/>
        </mx:WebService>
        
        <mx:StringValidator id="authorV" source="{bookAuthor}"
property="text" minLength="1" maxLength="55" required="true"/>
        <mx:StringValidator id="titleV" source="{bookTitle}"
property="text" required="true"/>       
        <mx:StringValidator id="genreV" source="{bookGenre}" property="text"
required="true" minLength="3"/> 
        <mx:StringValidator id="linkV" source="{bookLink}" property="text"
required="true" minLength="3"/> 
        
        <mx:VBox height="100%" left="10" top="10" right="10" bottom="10"
id="main_vb" horizontalAlign="center" verticalAlign="top"
verticalGap="10">
                <mx:Panel width="50%" height="100%" layout="absolute"
id="panel_for_dg" title="">
                        <mx:VBox width="100%" horizontalAlign="center">
                                <mx:DataGrid x="0" y="0" id="qryDG_dg" 
width="100%" height="120">
                                        <mx:columns>
                                                <mx:DataGridColumn 
headerText="Author" dataField="author"/>
                                                <mx:DataGridColumn 
headerText="Title" dataField="title"/>
                                                <mx:DataGridColumn 
headerText="Genre" dataField="genre"/>
                                                <mx:DataGridColumn 
headerText="Link" dataField="link"/>
                                        </mx:columns>
                                </mx:DataGrid>
                                <mx:Button x="10" y="128" label="Get Query from 
Standard Remoting"
width="100%" id="qry_btn" click="qryService.getAllBooks();"/>
                                <mx:DataGrid id="wsdlDG01_dg" width="100%" 
height="120">
                                        <mx:columns>
                                                <mx:DataGridColumn 
headerText="Author" dataField="AUTHOR"/>
                                                <mx:DataGridColumn 
headerText="Title" dataField="TITLE"/>
                                                <mx:DataGridColumn 
headerText="Genre" dataField="GENRE"/>
                                                <mx:DataGridColumn 
headerText="Link" dataField="LINK"/>
                                        </mx:columns>
                                </mx:DataGrid>
                                <mx:Button x="10" y="128" label="Get Query from 
Web Service using
MXML" width="100%" id="wsdl01_btn"
click="wsdlQryService.getAllBooks();"/>                         
                        </mx:VBox>
                        
                        <mx:Form x="0" y="310" width="100%" id="infoForm">
                                <mx:FormHeading label="Enter values into the 
form."/>
                                <mx:FormItem label="Label">
                                        <mx:TextArea id="error"/>
                                </mx:FormItem>
                                
                                <mx:FormItem label="Author Name">
                                    <mx:TextInput id="bookAuthor" width="100%"/>
                                </mx:FormItem>
                                
                                <mx:FormItem label="Title">
                                    <mx:TextInput id="bookTitle" width="100%"/>
                                </mx:FormItem>
                                
                                <mx:FormItem label="Genre">
                                    <mx:TextInput id="bookGenre" width="100%"/>
                                </mx:FormItem>
                                
                                <mx:FormItem label="URL">
                                    <mx:TextInput id="bookLink" width="100%" />
                                </mx:FormItem>
                                   
                                <mx:FormItem label="">
                                    <mx:Button id="form_btn" label="Submit 
Form" width="100%"
click="submitBook();"/>
                                </mx:FormItem>              
                
                        </mx:Form>
                </mx:Panel>
        </mx:VBox>
</mx:Application>



services-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<services-config>

    <services>
        <service id="coldfusion-flashremoting-service"
                 class="flex.messaging.services.RemotingService"
                 messageTypes="flex.messaging.messages.RemotingMessage">

            <adapters>
                <adapter-definition id="cf-object"
class="coldfusion.flash.messaging.ColdFusionAdapter" default="true"/>
            </adapters>

            <destination id="ColdFusion">
                <channels>
                    <channel ref="my-cfamf"/>
                </channels>
                <properties>
                    <source>*</source>
                    <!-- define the resolution rules and access level
of the cfc being invoked -->
                    <access>
                        <!-- Use the ColdFusion mappings to find CFCs,
by default only CFC files under your webroot can be found. -->
                        <use-mappings>false</use-mappings>
                        <!-- allow "public and remote" or just
"remote" methods to be invoked -->
                        <method-access-level>remote</method-access-level>
                    </access>

                    <property-case>
                        <!-- cfc property names -->
                        <force-cfc-lowercase>false</force-cfc-lowercase>
                        <!-- Query column names -->
                       
<force-query-lowercase>false</force-query-lowercase>
                        <!-- struct keys -->
                       
<force-struct-lowercase>false</force-struct-lowercase>
                    </property-case>
                </properties>
            </destination>

        </service>
    </services>

    <channels>
        <channel-definition id="my-cfamf"
class="mx.messaging.channels.AMFChannel">
            <endpoint
uri="http://{server.name}:{server.port}{context.root}/flex2gateway/";
class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
                <serialization>
                    <instantiate-types>false</instantiate-types>
                </serialization>
            </properties>
        </channel-definition>
    </channels>

    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <properties>
                <prefix>[Flex] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
                <pattern>Message.*</pattern>
            </filters>
        </target>
    </logging>

    <system>
    </system>

</services-config>







--
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