Calling webservice in flex3.0

Posted on 2009-04-22
Last Modified: 2012-05-06
Can anyone tell me the steps to call the webservice using flex3.0.Webservice is written in java and populate the datagrid of flex.
Question by:jdpositive
    LVL 12

    Accepted Solution

    LVL 3

    Expert Comment

    this should help you out...its assuming your webservice is giving back xml.

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="" layout="absolute"

                      import mx.collections.ArrayCollection;
                      import mx.collections.XMLListCollection;
                      import mx.controls.Alert;
                      import mx.utils.ObjectUtil;

                      public function grabXML():void{

                      [Bindable] private var dp:XMLListCollection;

                      private function httpService_result(evt:ResultEvent):void {
                            dp=new XMLListCollection( as XMLList);

                            //the fields in my xml being returned are band, album and title


                <mx:HTTPService id="httpService" showBusyCursor="true"
                                        resultFormat="e4x" url="music.xml"
                                        result="httpService_result(event)" />


                <mx:VBox horizontalAlign="center" verticalAlign="top" width="100%" height="100%">

                            <mx:DataGrid id="songList" labelField="title" dataProvider="{dp}"  width="100%" height="100%"  
                                           selectionColor="#AAAAAA" borderStyle="none" borderVisible="false">
                                        <mx:DataGridColumn headerText="Band" dataField="@band"   />
                                        <mx:DataGridColumn headerText="Album" dataField="@album"/>
                                        <mx:DataGridColumn headerText="Song" dataField="@title"/>


    LVL 29

    Expert Comment

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Advanced Datagrid with checkbox 4 289
    LinkList not supported? 8 288
    AS 3 - Movie editor 7 474
    Flex Mobile: Get Gps Coordinates 6 1,324
    First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video discusses moving either the default database or any database to a new volume.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now