5 Replies Latest reply on Mar 27, 2008 5:25 AM by kdennis4

    MIssing something to add a record

    kdennis4
      I am using Flex 3 and do not have the documentation or any references books to refer to. I am including my code below if someone could please let me know what I'm missing:

      Within the <mx:script>

      [Bindable]
      public var objUser:creativeUser;

      private function addNewUser():void{
      var i:int;
      objUser = new creativeUser;
      objUser.newLogin = newUserLogin;
      objUser.newPassword = newUserPassword;

      creativeLogin.addNewUser(objUser);
      }


      Within Remote Object id = creativeLogin, source=to CFC, and a method = addNewUser.

      My submit button has click="addNewUser()"

      I would greatly appreciate any feedback. My errors state:
      Type was not found or was not a compile-time constant: creativeUser
      Call to a possibly undefined method creativeUser

      Thanks so much!
        • 1. MIssing something to add a record
          kdennis4 Level 1
          I used a reference by Ray Camden and it compiles fine now .... However, I'm getting a different error outside of Flex in the browser when I hit submit I get an error:

          [MessagingError message='Destination 'ColdFusion' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']

          and...

          Couldn't establish a connection to 'ColdFusion'

          Any help with this issue would be greatly appreciated! Thanks!
          • 2. MIssing something to add a record
            levancho Level 3
            new creativeUser; missing brackets, --> new creativeUser();

            ------------

            you have to configure flex project to use blazeds service and then setup a web server (most likely tomcat) to host blazeds , and after that flexbuilder will bake service configuration into swf file.

            • 3. Re: MIssing something to add a record
              kdennis4 Level 1
              I noticed some other posts about have the services-config.xml, but I only have flex-config.xml. I did a complete search of my computer to make sure that it wasn't somewhere that I could copy it into the correct folder. Does anyone know if this is a Flex 3 issue or does anyone have any suggestions on what I can do. It seems as if this is my issue, but not sure. Thanks again!
              • 4. Re: MIssing something to add a record
                Garyl Woolworth Level 1
                services-config.xml is a file that you create and compile into your flex application. This doesn't necessarily mean that you use blazeds. Coldfusion has built in gateways to talk to Flex. An example of the services-config.xml file is as follows. Notice the destination id="ColdFusion"

                <?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>
                • 5. Re: MIssing something to add a record
                  kdennis4 Level 1
                  I've got the -services-config.xml properly set up now within Flex, but now I'm getting these errors:

                  Send failed - then I hit "OK"

                  Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 405: url: ' http://mySite.com/flex2gateway/'

                  I read some pasts posts about setting up the correct port... localhost:8500? Not sure if it's set that way or how to reset it if this is the issue that's causing the errors. Thanks again for any comments and help.