Calling webservice in flex3.0

Can anyone tell me the steps to call the webservice using flex3.0.Webservice is written in java and populate the datagrid of flex.
jdpositiveAsked:
Who is Participating?
 
chrisP4DCommented:
this should help you out...its assuming your webservice is giving back xml.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
       creationComplete="grabXML()">

      <mx:Script>
            <![CDATA[
                  import mx.collections.ArrayCollection;
                  import mx.collections.XMLListCollection;
                  import mx.controls.Alert;
                  import mx.rpc.events.FaultEvent;
                  import mx.rpc.events.ResultEvent;
                  import mx.utils.ObjectUtil;
                  

                  
            
                  
                  public function grabXML():void{
            
                        httpService.send();
                        
                        
                        
                  }

                  
                  [Bindable] private var dp:XMLListCollection;

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

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

                  
            ]]>
      </fx:Script>      
      

            <mx:HTTPService id="httpService" showBusyCursor="true"
                                    resultFormat="e4x" url="music.xml"
                                    fault="Alert.show(event.fault.faultString,'Error')"
                                    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:columns>
                                    <mx:DataGridColumn headerText="Band" dataField="@band"   />
                                    <mx:DataGridColumn headerText="Album" dataField="@album"/>
                                    <mx:DataGridColumn headerText="Song" dataField="@title"/>
                              </mx:columns>
                              </mx:DataGrid>
      

</mx:VBox>

      
</mx:Application>
0
 
dgofmanCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.