2 Replies Latest reply on Nov 30, 2006 3:57 PM by Andrew_Lattimore

    Retrieving Web service method in Flex question

    xyco45 Level 1
      I created a method in ASP.NET C# based Web service that returns a array of objects (each object containing string data). My question is, is it possible to to call that method in Flex and use the data from one of the objects in the array? in a ASP.NET web form I can access the data with in a object inside a array no prob, simply by doing something like this
      string tmpVar = methodName()[1].classFieldName;
      and I can access the data nice and easy. Is it possible to access that same object data Flex using the same method? Any ideas, links, suggetions, ANYTHING!! would be a huge help, I really don't want to have to rewrite my code.

      Thanx a bunch in advanced :-)
        • 1. Re: Retrieving Web service method in Flex question
          ntsiii Level 3
          I have never tried to pass complex objects to Flex. All i can suggest is to try.

          Now, Web services serialize objects into xml and Flex will handle this fine. The default resultFormat is object an Flex will try to convert the soap xml into a nested object structure. But i am not confident this will produce a good result for you.

          I suggest setting resultFormat="e4x", especially to start with. It is easy to manipulate and view the xml in Flex, mor so than with Object/

          Are you running Flex Builder? You will need some way to look at your result object. You can trace or alert, but that is very difficult, like shooting in the dark.

          Have you successfully gotten data from a web service into Flex yet? That in itself is a bit of a challenge. You will ABSOLUTELY need to use a result handler function.

          Post back with any specific issues.

          Tracy
          • 2. Re: Retrieving Web service method in Flex question
            Andrew_Lattimore
            I'm using the mx:WebService to access my cfc's and have not had any problem using the data returned from my methods. Although I'm not C# smart, if your webservice functions like a ColdFusion component then you shouldn't have any problems using your objects in Flex. My functions (methods) return a query and I use the data elements in my mx:DataGrid and mx:Chart, as well as in the mx:ComboBox tag. Flex uses braces {} to bind the data returned to an object in Flex. My suggestion is to review Getting Started with Flex 2 and work through the tutorials. They helped me a great deal and I refer to them often.