<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="986" height="574">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectProxy;
private function onResult(event:ResultEvent): void {
ws.isValidSession();
}
private function onResult2(event:ResultEvent): void {
var result:String = event.result as String;
}
private function onResult3(event:ResultEvent): void {
var result:Boolean = event.result as Boolean;
if ( result == true)
{
Alert.show("Session Valide")
ws.getDocuments(null, null, null)
}
else
{
Alert.show("Session Invalide");
}
}
private function onFault(event:FaultEvent): void {
Alert.show("Error");
}
private function onFault3(event:FaultEvent): void {
Alert.show("Error3");
}
private function callWS():void {
ws.openSession( user.text, pwd.text);
}
]]>
</mx:Script>
<mx:WebService id="ws" wsdl="http://localhost:8080/SpagoBI/services/WSSessionService?wsdl">
<mx:operation name="openSession" result="onResult(event)" fault="onFault(event)" />
<mx:operation name="getDocuments" result="onResult2(event)" fault="onFault(event)"/>
<mx:operation name="isValidSession" result="onResult3(event)" fault="onFault3(event)"/>
</mx:WebService>
<mx:Label x="184" y="156" text="Username"/>
<!-- <mx:Image x="184" y="74">
<mx:source>file:///C|/Documents and Settings/Stagiaire/Bureau/Pic/logo.gif</mx:source>
</mx:Image>-->
<mx:TextInput id="user" x="184" y="173" width="80"/>
<mx:Label text="Password"/>
<mx:TextInput id="pwd" x="184" y="218" width="80"/>
<mx:Button label="OK" click="callWS()"/>
<mx:TextArea id ="contenu"/>
</mx:Application>
Partager