Web Service Multiple Operations : WebService « Data Model « Flex






Web Service Multiple Operations

Web Service Multiple Operations
         
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      
      [Bindable]
      private var contactData:ArrayCollection;
      [Bindable]
      private var helloData:String;
      
      private function contactsResultHandler(event:ResultEvent):void
      {
        contactData = event.result as ArrayCollection;
      }
      private function helloResultHandler(event:ResultEvent):void
      {
        helloData = event.result as String;
      }
      private function faultHandler(event:FaultEvent):void
      {
        Alert.show(event.fault.faultString, event.fault.faultCode);
      }
  
  </mx:Script>

  <mx:WebService id="myService" wsdl="http://localhost/Service.cfc?wsdl" fault="faultHandler(event)">
    <mx:operation name="getAllContacts" result="contactsResultHandler(event)"/>
    <mx:operation name="helloWorld" result="helloResultHandler(event)"/>
  </mx:WebService>
  
  <mx:Button label="Get String" click="myService.helloWorld()"/>
  <mx:Label text="{helloData}" />
  
  <mx:Button label="Get Data" click="myService.getAllContacts()"/>
  <mx:DataGrid dataProvider="{contactData}">
    <mx:columns>
      <mx:DataGridColumn dataField="firstName" headerText="First Name"/>
      <mx:DataGridColumn dataField="lastName" headerText="Last Name"/>
    </mx:columns>
  </mx:DataGrid>
  
</mx:Application>

   
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Feed returning value from WebService to a DataGridFeed returning value from WebService to a DataGrid
2.A load event for WebServiceA load event for WebService
3.A fault event for WebServiceA fault event for WebService
4.Call service with WebService
5.Call web service wsdl with WebService and operation in MXML
6.Call WebService with ActionScript
7.Call WebService with operation names
8.Explicit parameter passing with RemoteObject and WebService componentsExplicit parameter passing with RemoteObject and WebService components
9.Define name space for WebServiceDefine name space for WebService
10.WebService error eventWebService error event
11.Get result for WebService callGet result for WebService call
12.Convert returning value from WebService to ArrayCollectionConvert returning value from WebService to ArrayCollection
13.Call a web service
14.Use a web service to process form input dataUse a web service to process form input data
15.Call a web service and assign returning value to form controlsCall a web service and assign returning value to form controls
16.Call web service with operation defined
17.Call a web service that queries a SQL database and returns data to Flex
18.Web Service Fault EventWeb Service Fault Event
19.Web Service OperationWeb Service Operation
20.Web Service Result Event
21.Web Service With Bindings
22.Web Service Bounded ParamsWeb Service Bounded Params
23.Get DataSet from ASP.net web service
24.Call Asp.net asmx web service
25.Call Asp.net web service and pass parameters
26.Use Web service to validate inputUse Web service to validate input
27.Adding a web service to process form input data.
28.Call WSDL serviceCall WSDL service
29.Call method in WSDL file
30.Create a namespace object for soap:BodyCreate a namespace object for soap:Body