4 Replies Latest reply on Jul 29, 2008 11:54 AM by Bob Saggot

    Httpservice and CFC's? Possible?

    Bob Saggot
      I only see posts to CFM's, but is it possible to straight access a cfc from httpservice? Thanks
        • 1. Re: Httpservice and CFC's? Possible?
          ntsiii Level 3
          I do not know CF, but if a CFC can be built to respond with XML, then yes, you can hit it directly with HTTPService.

          Hit the CF Url in a browser, if you see xml, you are golden.

          In dot.net, I set Response.ContentType = "text/xml", and return an XML string. Flex's HTTPService loves it just fine.

          Set resultFormat="e4x".

          Tracy

          Tracy
          • 2. Re: Httpservice and CFC's? Possible?
            Reevesp
            quote:

            Originally posted by: Bob Saggot
            I only see posts to CFM's, but is it possible to straight access a cfc from httpservice? Thanks



            Yes you can, but I'm not a big fan of XML so I stick with RemoteObject calls to the CFCs.

            So the source of the RemoteObject is the CFC and the mx:method's name is the name of a method in my CFC.

            The arguments of the mx:method are the same as the arguments for the CFC method, and they are currently bound to two TextInputs.

            Hope all this helps!
            • 3. Re: Httpservice and CFC's? Possible?
              Bob Saggot Level 1
              Thanks for your replies.

              Reply to NTSII:
              I can get all my XML to display fine with a CFM, but thats an entire CFM file just to display 1 query, i have 50 queries all devided up into functions in one CFC.

              i.e.
              users.cfc contains
              userLogin
              addUser
              deleteUser

              while one cfm can just contain "userLogin"
              then i'd have to create a addUser.cfm and deleteUser.cfm etc etc.

              ReevesP:
              I am using remote object and love it, but I need to access my coldfusion server on a different host, so I have to switch over and use httpservice or webservice.
              • 4. Re: Httpservice and CFC's? Possible?
                Bob Saggot Level 1
                I am going to consider this solved, with the solution being to use cfm's but just have a var say what function to go to.

                i.e.
                var service:httpservice = new httpservice();
                service.blahblahblah etc
                var loginid:Object = new Object;
                loginid.id = '21';
                loginid.function = '3';
                service.send(loginid);

                then my cfm file is going to be pretty basic

                <cfif(function eq 3)>
                do what function i need.
                </cfif>
                <cfif(function eq 4)>
                do what function i need.
                </cfif>

                etc