Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

dataservice call fault error after session timeout does not get trapped in the fault handler

Avatar

Level 2

Hi,

My data service call after the session time out for about 30 mins, does not get trapped into the fault handler. It pops up a Flash player error on the AIR simulator. I have some code to handle for session timeout error in the faulthandler. My server returns an exception for session timeout. My server log shows that it returns the exception, but it does not return to fault handler, instead throws a fault error on the UI in form of popup.  I am using RTMP channel with below configuration.

 

<channel-definition id="mobility-rtmp"

      class="mx.messaging.channels.RTMPChannel">

      <endpoint url="rtmp://{server.name}:@flex.rtmp.port@"

        class="flex.messaging.endpoints.RTMPEndpoint"/>

      <properties>

        <idle-timeout-minutes>20</idle-timeout-minutes>

      </properties>

    </channel-definition>


    <flex-client>

        <timeout-minutes>5</timeout-minutes>

    </flex-client>

Please let me know how I can handle this.

Thanks,

Swathi.

3 Replies

Avatar

Former Community Member

Hi

Can you post the code you are using to register the faultHandler? Just to confirm, you need to register the faultHandler at the service level like this:

userService.addEventListener("fault", faultHandler);

Regards,

Ashish Vashisht

Avatar

Level 2

Hi Ashish,

Thank you for the response. I am having this issue only on session time out or server down scenario. Here is how my code looks like.

Here is part of code from my service class, the dataservice is injected.

[Inject]

public var customdataservice:CustomDataService;

private var syncFillData():void

{

var asyncToken:AsyncToken = customdataservice.synchronizeFill(buildRemoteQuery());

          asyncToken.addResponder(new AsyncResponder(syncFillResult, syncFillFault));

          return asyncToken;

}

private function syncFillFault(fault:FaultEvent, token:Object):void
    {
           // do some session time out handling here based on the error message

   }

private function syncFillResult(result:ResultEvent, token:Object):void
    {
           // syncfill service call successfull

   }

MyCustomDataService extends the BaseDataService class, like below

public class CustomDataService extends BaseDataService
  {
    public function CustomDataService()
    {
      super("CustomService", "CustomCache");
      offlineAdapter = new CustomOfflineAdapter();
    }
  }

Here is the code for BaseDataService.

public class BaseDataService extends DataService
  {
   

    private var _connectionModel:ConnectionModel;

    public function get connectionModel():ConnectionModel
    {
      return _connectionModel;
    }

    [Inject]
    public function set connectionModel(value:ConnectionModel):void
    {
      _connectionModel = value;
      this.channelSet = connectionModel.channelSet;
    }


    public function BaseDataService(destination:String,cacheID:String="MobilityCache")
    {
      trace("Constructor BaseDataService destination=" + destination);
      super(destination);
      this.cacheID = cacheID;
      autoSaveCache = true;
      autoConnect = true;
      autoCommit = false;
      encryptLocalCache=true;
       fallBackToLocalFill = true;
      requestTimeout = 20;
    }
  }

We are using robotlegs for dependency injection.

Please let me know for any other questions.

Thanks,

Swathi.

Avatar

Former Community Member

Hi

Sorry for the delayed response - I was out of office for the last week.

Where you have instantiated your DataService (customdataservice variable), you should add an event handler for the fault event like this:

customdataservice.addEventListener("fault", faultHandler);

where faultHandler is the function you want called on a fault happening.

For more information, see here:

http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WSc3ff6d0ea77859461172e0811f00f70...

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/data/DataService.html#eventSum...

http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WS3a1a89e415cd1e5d-d5245eb1221394...

Regards,

Ashish Vashisht