AnsweredAssumed Answered

Flex and Web Scripts

Question asked by cedomir on Dec 10, 2008
Latest reply on Dec 13, 2008 by cedomir
Hi,
I need help on using Web Scripts in Flex (ActionScript). I managed to log in using examples in wiki, but when I try to issue another call to Web Script (ie. to create Space), I get error "Unable to execute web script because required ticket is not available from the AuthenticationService". Any pointer to examples etc. is appreciated.

public function alf_login():void
{
      var url:String = _alf_server_url + "alfresco/service/api/login";
      var webScript:WebScriptService = new WebScriptService(url, WebScriptService.GET, onLoginSuccess, onLoginFailure, false);
         
      var params:Object = new Object();
      params.u = "admin";
      params.pw = "admin";

      webScript.execute(params);
}

public function onLoginSuccess(event:SuccessEvent):void
{
   this._ticket = event.result.ticket;
}

public function create_space():void
{
   var url:String = _alf_server_url + _in_folder + "/children";
   var webScript:WebScriptService = new WebScriptService(url, WebScriptService.POST, onCreateSuccess, onCreateFailure, true);
         
   var params:Object = new Object();
   params.name = "Example";
   params.TypeId = "folder";

   webScript.execute(params);
}

Outcomes