未调用WL.Client.connect-onSuccess回调



给定以下代码,在成功连接时不会回调onSuccess。我已经列出了事件序列的代码和日志输出。代码设置错误吗?connectOnStartup在initOptions中设置为false。此代码也在Shell项目中,logcat来自使用Shell:的内部项目

function onConnectSuccess(){
    console.log ("CSXMobile:onConnectSuccess");
    WL.Logger.debug("CSXMobile:onConnectSuccess");
}
function onConnectFailure(){
    WL.Logger.debug("CSXMobile:onConnectFailure");
}
function disconnectDetected(){
    WL.Logger.debug("CSXMobile:disconnectDetected");
}
function connectDetected(){
    WL.Logger.debug("CSXMobile:connectDetected");
}
function wlCommonInit(){
    WL.Logger.debug("CSXMobile:wlCommonInit");
    document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false); 
    document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false);
     WL.Client.connect({
         onSuccess: onConnectSuccess,
         onFailure: onConnectFailure
     });
}

正如这里的日志所示,wlCommonInit正在被调用和记录,但onConnectSuccess中的日志语句从未被写入。。。

11-21 13:49:01.460: D/CSXMobileShellTest(6341): wlclient init started
11-21 13:49:01.460: D/CSXMobileShellTest(6341): Read cookies: null
11-21 13:49:01.460: D/CSXMobileShellTest(6341): CookieMgr read cookies: {}
11-21 13:49:01.507: D/dalvikvm(6341): GC_CONCURRENT freed 311K, 4% free 11407K/11783K, paused 2ms+16ms, total 34ms
11-21 13:49:01.507: D/CordovaNetworkManager(6341): Connection Type: wifi
11-21 13:49:01.507: D/DroidGap(6341): onMessage(networkconnection,wifi)
11-21 13:49:01.507: D/DroidGap(6341): onMessage(spinner,stop)
11-21 13:49:01.507: D/CordovaLog(6341): CSXMobile:csxmobileDeviceReady
11-21 13:49:01.507: I/Web Console(6341): CSXMobile:csxmobileDeviceReady at file:///data/data/com.csx.CSXMobileShellTest/files/www/default/js/CSXMobile.js:172
11-21 13:49:01.538: D/CSXMobileShellTest(6341): CSXMobile:deviceOnline
11-21 13:49:01.546: D/CSXMobileShellTest(6341): before: app init onSuccess
11-21 13:49:01.546: D/CSXMobileShellTest(6341): CSXMobile:wlCommonInit
11-21 13:49:01.561: D/CSXMobileShellTest(6341): Request [https://myworklightserver/query]
11-21 13:49:01.585: D/CSXMobileShellTest(6341): after: app init onSuccess
11-21 13:49:01.585: D/CSXMobileShellTest(6341): added onPause event handler 
11-21 13:49:01.585: D/CSXMobileShellTest(6341): wlclient init success
11-21 13:49:01.858: D/CSXMobileShellTest(6341): isCustomResponse
11-21 13:49:01.858: D/CSXMobileShellTest(6341): isCustomResponse true
11-21 13:49:01.858: D/CSXMobileShellTest(6341): handleChallenge
11-21 14:14:57.796: D/DroidGap(6656): onMessage(spinner,stop)
11-21 14:15:08.975: D/CSXMobileShellTest(6656): Request [login]
11-21 14:15:09.132: D/CSXMobileShellTest(6656): Status =401
11-21 14:15:09.132: D/CSXMobileShellTest(6656): isCustomResponse
11-21 14:15:09.139: D/CSXMobileShellTest(6656): isCustomResponse false
11-21 14:15:09.147: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query]
11-21 14:15:09.163: D/CSXMobileShellTest(6656): hideLogin
11-21 14:15:09.413: D/Cordova(6656): onPageFinished(file:///data/data/com.csx.CSXMobileShellTest/files/www/default/CSXMobileShellTest.html#testMainPage)
11-21 14:15:09.413: D/Cordova(6656): Trying to fire onNativeReady
11-21 14:15:09.413: D/DroidGap(6656): onMessage(onNativeReady,null)
11-21 14:15:09.413: D/DroidGap(6656): onMessage(onPageFinished,file:///data/data/com.csx.CSXMobileShellTest/files/www/default/CSXMobileShellTest.html#testMainPage)
11-21 14:15:09.475: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query]
11-21 14:15:09.522: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query]
11-21 14:15:09.616: D/CSXMobileShellTest(6656): isCustomResponse
11-21 14:15:09.616: D/CSXMobileShellTest(6656): isCustomResponse false
11-21 14:15:09.616: D/CSXMobileShellTest(6656): CSXMobile:connectDetected
11-21 14:15:09.647: D/CSXMobileShellTest(6656): response [https://myworklightserver/query] success: /*-secure-

我能够ping到IBM的联系人并获得反馈。我们正在与WL.Client.createChallengeHandler一起实现challengeHandler。我省略的一个关键项目是执行challengeHandler.submitSuccess();成功登录后。一旦我在成功登录例程中添加了这一行,一切都很好。

最新更新