Atom service : HTTPService « Data Model « Flex






Atom service

Atom service
          
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="service.send();">
    <mx:Script>
        
            import mx.controls.Alert;
            import mx.rpc.http.HTTPService;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.events.FaultEvent;
            
            private namespace atom = "http://www.w3.org/2005/Atom";
            use namespace atom;
            
            private function resultHandler(event:ResultEvent):void
            { 
                var feeds:XML = event.result as XML;
                trace(feeds.entry[0].title);
            }
             
            private function faultHandler(event:FaultEvent):void
            { 
                service.removeEventListener(FaultEvent.FAULT, faultHandler);
                Alert.show(event.fault.message, "Could not load XML");
            }
            
      
    </mx:Script>
    
    <mx:HTTPService id="service"
            url="Atom.xml"
            resultFormat="e4x"
            result="resultHandler(event);"
            fault="faultHandler(event);"/>
    
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use HTTPService to access phpUse HTTPService to access php
2.Access returning value from a HTTPService
3.Request response data communication with HTTPServiceRequest response data communication with HTTPService
4.Pass parameter to HTTPService
5.Use HTTPService to call Php page and pass parameter with requestUse HTTPService to call Php page and pass parameter with request
6.A url property on the HTTPService componentA url property on the HTTPService component
7.Convert returning value from HTTPService to ArrayCollectionConvert returning value from HTTPService to ArrayCollection
8.Feed returning value from HTTPService to a DataGridFeed returning value from HTTPService to a DataGrid
9.Use HTTPService to call a jsp pageUse HTTPService to call a jsp page
10.Add ItemResponder for HTTPServiceAdd ItemResponder for HTTPService
11.Use HTTPService to load an image fileUse HTTPService to load an image file
12.HTTPService fault event and result eventHTTPService fault event and result event
13.Read binary resource from HTTPService
14.Set result format of HTTPService to E4XSet result format of HTTPService to E4X
15.Use an ArrayCollection, convert the HTTPService result to an ArrayCollectionUse an ArrayCollection, convert the HTTPService result to an ArrayCollection
16.Define XML file as a URL for an HTTPService component, and bind HTTPService result directly to the chart's data provider
17.Calling HTTP services in ActionScript
18.Default Proxy Destination
19.Named Proxy Destination CompleteNamed Proxy Destination Complete
20.RSS feed client
21.Rss readerRss reader
22.Two ways to call an HTTP service using the send() method with a parameterTwo ways to call an HTTP service using the send() method with a parameter