6 Replies Latest reply on Nov 6, 2006 11:23 AM by davidmedifit

    Object + Array + Flex Form + WebService

    ljonny18
      Hi

      I have created a form with Flex 2, all the values entered within the form are taken and sent to a webService.

      Currently I put all of the form items into an Object and send the object to the webService, now the application has changed and contains an editable dataGrid which stores its values in an array so therefore I now need to send an Array to my webService as well as my object….

      My question is, - is it possible to send my array within (inside my object) and pick it up in the webService, or do I have to send them (the object and array) separately – hence having 2 calls to the webService etc…. ???


      Thanks,
      Jon.
        • 1. Re: Object + Array + Flex Form + WebService
          davidmedifit Level 1
          Jon - great question, did you ever get an answer to this? I would think in the past I have sent over the contents of a (for example) selected datagrid array item to the web service (i.e., one call to the WS). I dont' have examples of editable datagrids, but I have examples of data grid / form processing and web services, if you like.

          Cheers,

          David
          • 2. Re: Object + Array + Flex Form + WebService
            NUMB-LOCK
            Hi David,

            Any chance you could post your examples of sending complex objects (i.e. Object with an array) to a web service?

            Thanks,

            Bob
            • 3. Re: Object + Array + Flex Form + WebService
              Camus Miu
              I want to know as well...

              BTW, what kind of security measure you employed for the WS?
              Do you restrict the access of the WS to localhost only?
              • 4. Re: Object + Array + Flex Form + WebService
                ljonny18 Level 1
                Hi Dave, yes that would be a great help if you could post your example!!!

                no, I have not found an answer to this yet, as Iam still working on it - but when I try, I am getting "mis-match" errors.....

                thanks,
                Jon.
                • 5. Re: Object + Array + Flex Form + WebService
                  ljonny18 Level 1
                  Additionally........
                  This may be relevant / help in some cases - Regarding this problem and as to how far I have got to solving it!

                  Summary, The object is a “complex” object containing various variables but additionally a few arrays that is to be passed to a CF webService…..

                  So far, when the object is passed to the ".CFC" it accepts it as a struct (which is what I have done in the past and seems to work fine….) although in this case in kicks off throwing out errors that it does not like the object…

                  If the object was a “simple” object (ie is "flat" - without the arrays) then there are no errors and the CFC accepts it fine....

                  From what I can work out, the CFC webService cannot handle "complex" objects, only "simple" ones…
                  If this is the case (which I am hoping is not) I guess a solution to this would be to “flatten” the Object and loop through the arrays within the object – which would be a long-winded and untidy solution - that I want to try to avoid if possible!

                  thus I have to ask myself:
                  Firstly, is this the case… or am I completely wrong and my CFC can support complex objects???

                  Secondly, is there another option to my solution – i.e. can I use an alternative like a remoteObject – or will this be the same result???

                  which is where I am now..... looking into the "Remote Object" call although this taking out the varios advantageous pointers of using a webService

                  if anyone has any further pointers, advice or suggestions please let me know.... and I will post what I find / if I find anything :S

                  Thanks,
                  Jon.
                  • 6. Re: Object + Array + Flex Form + WebService
                    davidmedifit Level 1
                    Bob / Jon,
                    My apologies for getting back to you late, but Iwas on paternity leave all last week.

                    As I'm a little short on time, I'll refer you to a presentation I did for my CF user group: http://www.cfugitives.com/index.cfm?commentID=45

                    This is a simple example, but it uses Web Services (launch from your local browser). I'm not sure it's what you want, though, so please reply if it's too simplistic. Like I said, I'm a little short on time, and I didn't want to ignore you. I think the CFC code is in the PDF, if its not, I'll post it to that blog entry.

                    In general, I hear what you are trying to say about passing "complex" variables. This may not be the right forum (I'd try the CF forum). To the best of my knowledge, I'd say you are over-reaching. Web Services rely on XML, which are basically text streams. I'll look into it though, and see what I can find.

                    As for remote object calls - if you search this forum for my previous posts (davidmedifit), I'm pretty sure I've posted code on how to access remote objects that are CFC's. Personally, I think that this is the route to go, if you have the option, for various reasons.

                    1) The "native" concept - Adobe made CF and Flex work well together, especially with passing data with each other (queries, etc).
                    2) Security. There is a significant risk if you are passing information to a WS on a publically accessible domain. At very least, your Flash app can be de-compiled, and someone can view the target WSDL file. From there on in, it's publically accessible. Not a big deal if you are returning weather info for a zip code, or stock ticker information, but a big deal if you are sending personal information.
                    3) Speed. I have been told Flex / CF is the fastest combination availble.

                    Again, sorry for the very non-specific answers in this reply, like I said, I'm in a bit of a time crunch here. I don't like to leave my posts hanging, and would like to get to the answer myself.

                    Cheers,

                    David