12 Replies Latest reply on Jan 11, 2012 8:21 AM by Dave Watts

    Connecting to cfcs via non flash platforms

    nikos101 Level 2

      I am looking to use mosync to develop for mobile rather than air. Is there a way to Connecting to cfcs via non flash platforms, ie not usiong the flashservices gateway?

        • 2. Re: Connecting to cfcs via non flash platforms
          Dave Watts Adobe Community Professional

          I don't think that CFAJAXPROXY will be useful to the poster directly, as he won't be writing a CF-based client?

           

          But in any case, Adam's answer gets the gist of what you need. You can expose CFCs directly as web services using SOAP or JSON.

           

          Dave Watts, CTO, Fig Leaf Software

          • 3. Re: Connecting to cfcs via non flash platforms
            Adam Cameron. Level 5

            Sorry Dave, yeah you're right.  I am extremely hungover today, so was not focusing on my answer.  What I was kinda driving at (but in no way said) was to check what JS <cfajaxproxy> creates, and emulate that sort of approach.

             

            --

            Adam

            • 4. Re: Connecting to cfcs via non flash platforms
              Dave Watts Adobe Community Professional

              No need to apologize - 90% there is still most of the way!

               

              Dave Watts, CTO, Fig Leaf Software

              • 5. Re: Connecting to cfcs via non flash platforms
                nikos101 Level 2

                I actually just want to connect from android from the iphone so I guess I dont need the proxy?

                • 6. Re: Connecting to cfcs via non flash platforms
                  Dave Watts Adobe Community Professional

                  No, no proxy is needed. Just make sure your CFCs are accessible through the web server, then use the URLs of those CFCs as SOAP or JSON services in your application.

                   

                  Dave Watts, CTO, Fig Leaf Software

                  1 person found this helpful
                  • 7. Re: Connecting to cfcs via non flash platforms
                    nikos101 Level 2

                    use the URLs of those CFCs as SOAP or JSON services in your application

                     

                    So I can't use remote objects like this in my iphone app? Im finding it tricky cause in the past all my apps have resided in the same server as cf is running

                     

                    <mx:RemoteObject id="myService"

                                             destination="ColdFusion"

                                             showBusyCursor="true"

                                       

                                             source="flex.TravelMoney.Service">

                               

                               

                               

                            

                                <mx:method name="getAllData"

                                           result="handleGetAllData(event)"/>

                                <mx:fault>

                                    <![CDATA[

                                    var am:AlertMsg = new AlertMsg();

                                    am.open(this, false);

                                    am.lb.text = "Service error debug: \n\n" + event.fault.message;

                               

                                    ]]>

                                </mx:fault>

                               

                            </mx:RemoteObject>

                    • 8. Re: Connecting to cfcs via non flash platforms
                      Dave Watts Adobe Community Professional

                      You can't use MXML in your iPhone app, unless you're writing your iPhone app with Flex. You'd have to use your CFCs in whatever way your development environment lets you - as SOAP or JSON services.

                       

                      Dave Watts, CTO, Fig Leaf Software

                      • 9. Re: Connecting to cfcs via non flash platforms
                        nikos101 Level 2

                        Yeah it's a flex app. I want to use remote object cause that's how I use CFCs in the past

                        • 10. Re: Connecting to cfcs via non flash platforms
                          Dave Watts Adobe Community Professional

                          If you're writing a Flex app, you should be able to use RemoteObject.

                           

                          Dave Watts, CTO, Fig Leaf Software

                          • 11. Re: Connecting to cfcs via non flash platforms
                            nikos101 Level 2

                            Cool, Im trying to duplicate the my-cfamf in the services-config file with as:

                             

                             


                            channel = new AMFChannel;


                            channel.endpoint = 'http://www.mysite.com/flex2gateway/';

                             

                            do I need any of the other stuff like the coldfusion element use-mappings?        

                             

                            <!--  CF Based Endpoints -->

                                    <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">

                                            <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="coldfusion.flash.messaging.CFAMFEndPoint"/>

                                        <properties>

                                            <polling-enabled>false</polling-enabled>

                                            <serialization>

                                                <enable-small-messages>false</enable-small-messages>

                                            </serialization>

                                            <coldfusion>

                                                <!-- define the resolution rules and access level of the cfc being invoked -->

                                                <access>

                                                    <!-- Use the ColdFusion mappings to find CFCs-->

                                                    <use-mappings>true</use-mappings>

                                                    <!-- allow "public and remote" or just "remote" methods to be invoked -->

                                                    <method-access-level>remote</method-access-level>

                                                </access>

                             

                                                <!-- Whether the Value Object CFC has getters and setters. Set the value of use-accessors to true if there are getters and setters in the Value Object CFC. -->

                                                <use-accessors>true</use-accessors>

                                                <!--Set the value of use-structs to true if you don't require any translation of ActionScript to CFCs. The assembler can still return structures to Flex, even if the value is false. The default value is false.-->

                                                <use-structs>false</use-structs>

                             

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

                                            </coldfusion>

                                        </properties>

                                    </channel-definition>

                            • 12. Re: Connecting to cfcs via non flash platforms
                              Dave Watts Adobe Community Professional

                              Yeah, your CFCs need to have all of the CF-specific information. I'm not sure why you're creating a new channel, though - you can just use that one. Typically, the only reason I create new channels is if I want features not available in the default channels - for example, if I wanted to use HTTPS instead of HTTP.

                               

                              Dave Watts, CTO, Fig Leaf Software