<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
			   creationComplete="init();">
	<fx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			
			[Bindable]
			private var employeeList:Object;
			
			private function init():void {
				employeeServiceRO.getList();
			}
			
			private function resultHandler(event:ResultEvent):void {
				employeeList = event.result;
			}
			private function faultHandler(event:FaultEvent):void {
				//Alert.show(event.fault.faultString, 'Error');
				Alert.show(event.toString(), 'Error');
			}
		]]>
	</fx:Script>
	<fx:Declarations>
		<mx:RemoteObject id="employeeServiceRO" destination="employeeServiceDest"
						 result="resultHandler(event);" fault="faultHandler(event);"/>
	</fx:Declarations>
	<mx:DataGrid x="32" y="25" width="400" dataProvider="{employeeList}">
		<mx:columns>
			<mx:DataGridColumn headerText="Name" dataField="name"/>
			<mx:DataGridColumn headerText="Age" dataField="age"/>
			<mx:DataGridColumn headerText="Email" dataField="email"/>
		</mx:columns>
	</mx:DataGrid>
</s:Application>
