5 Replies Latest reply on Sep 19, 2008 1:33 AM by SujitG

    Newbie to Flex Http Services

    Level 1
      Hi,

      I am trying to Integrate Flex with Hibernate and want to use Http Service to communicate with the back end. Most of the related articles I read mention about Flex Data services. But I don't want to use them.
      Is it possible to build an application that integrates with Hibernate without using Data services?

      Thanks in advance
        • 1. Re: Newbie to Flex Http Services
          cartman1138
          By Data Services do you mean BlazeDS or the Live Cycle stuff? How you get from AS3 to Java is entirely up to you. If you want to POST to a servlet and send it a XML or some such that is up to you. The reason many people including me like BlazeDS is that it does a lot of the work for you. Pull objects out out of the DB and return them from the method. Then Shazam they show up in AS3 as fully hydrated objects. Why do you want to use raw HttpService? That may be the more important question.
          • 2. Re: Newbie to Flex Http Services
            Level 1
            I haven't looked much into BlazeDS or LiveCycle stuff. I was trying to use HttpService as I thought it was little fast and easy to write. I dont't have to buy license for Data services.
            Also I am not aware of the advantages of using Flex Data services. It would be really great if you throw some light on advantages of Data Services.

            Thanks in advance.
            • 3. Re: Newbie to Flex Http Services
              ntsiii Level 3
              I do not use Hibernate, but I do use HTTPService extensively. It is *very* simple to use and debug on both the client and the server.

              I use resultFormat="e4x" on the Flex client, and often use XMLListCollection thate as well.

              BlazeDS will use amf for transport and will be faster, but all of the protocols are very fast compared to client side rendereing, so don't let that be the primary deciding factor.

              Blaze will be harder to set-up and configure, but if your server-side datastructures are exactly what you want in your client, then the object mapping will be valuable. I have not needed that stuff yet.

              Tracy
              • 4. Re: Newbie to Flex Http Services
                cartman1138 Level 1
                Tracy made some good points. Just for the record BlazeDS is free. The deciding factor for me when I am building something is the amount of interaction. If you are dumping a few strings over the wire, maybe just put them in the query string. i.e. http://yourserver/yourServlet/add_a_record?string1=xyz&string2=123&string3=abc If on the other hand you have a whole object model you want to move back and forth then BlazeDS is a lot less work in the long run. I have to admit that I use Blaze in some cases where it is overkill, but once you have it up and running you copy most of the config as is where ever you go.
                Another thing I like about Blaze is that your "service" is just a POJO. I like that because I can create a simple JUnit test to put it through it's paces. I know there are various unit test thingies to test servlets, but that is too much work for me. Keep it simple. I am not in the test first crowd. Test as much as you need to and no more. I'm off the subject.
                At the end of the day it could take you from an hour to a week to get Blaze figured out in your head. Once that is done you can move big mountains with less effort than most any other way. If you just need to get it out the door and grungy hand coded conversion of what is essentially text is less effort, then do httpService. I would encourage you to look into Blaze anyway though.
                Don't forget that you can use WebServices. That is a good option also. I still prefer Blaze, but I try to fit the solution to the problem when possible. If you have a service already, Flex make that stuff reasonably easy.

                I hope that helps.

                John
                • 5. Re: Newbie to Flex Http Services
                  SujitG Level 2
                  Hi,

                  Points for considering BlazeDS in your case.

                  1. Data is transferred as objects and so the transfer time and data parsing time on both server and client side is reduced
                  2. Data transferred in AMF format is really fast
                  3. You have BlazeDS adapters for Hibernate which support lazy loading of Hibernate objects

                  Please find more details below.

                  Hibernate adapter: http://code.google.com/p/dphibernate/
                  Invoking Java methods from Flex: http://sujitreddyg.wordpress.com/2008/01/14/invoking-java-methods-from-adobe-flex/

                  Hope this helps.