IBM WL 6.1 iPhone客户端连接无限循环



我们公司正在试用Worklight。
在公司网络中设置了一个试用的WL服务器。

Internet上的设备必须经过外部防火墙才能到达WL服务器。防火墙接受443的连接。任何到达此地址的https流量都被反向代理到内部worklight服务器,我们称其为https://wl.virtual.corp.com:9443

如果设置了特定的cookie值,防火墙将只代理连接。为了尝试这个场景,我们使用DevStudio默认设置创建了一个非常简单的一页hello world混合式工作灯应用,它只显示一张图片。

wlInitOptions.js中"connectOnStartup"设置为"false"。

在main.js wlCommonInit()中,cookie设置为addGlobalHeader(),然后调用WL.Client.connect()

在android上一切正常- wl客户端连接并显示第一页。

在iOS上,连接成功和连接失败回调都不会被调用。
iOS日志显示了一个无限循环请求https://…iphone/init页面,然后是DeviceAuth -一遍又一遍没有结束,直到应用程序被强制关闭:

2014-06-05 16:15:03.330 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init]
2014-06-05 16:15:03.612 Mobilithon[177:60b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-06-05 16:15:03.629 Mobilithon[177:60b] THREAD WARNING: ['DeviceAuth'] took '16.558838' ms. Plugin should use a background thread.
2014-06-05 16:15:03.632 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init]
2014-06-05 16:15:03.818 Mobilithon[177:60b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-06-05 16:15:03.833 Mobilithon[177:60b] THREAD WARNING: ['DeviceAuth'] took '14.851074' ms. Plugin should use a background thread.
2014-06-05 16:15:03.837 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init]
2014-06-05 16:15:04.022 Mobilithon[177:60b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-06-05 16:15:04.036 Mobilithon[177:60b] THREAD WARNING: ['DeviceAuth'] took '14.554932' ms. Plugin should use a background thread.
2014-06-05 16:15:04.042 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init]
2014-06-05 16:15:04.236 Mobilithon[177:60b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-06-05 16:15:04.251 Mobilithon[177:60b] THREAD WARNING: ['DeviceAuth'] took '14.396973' ms. Plugin should use a background thread.
2014-06-05 16:15:04.254 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init]
2014-06-05 16:15:04.397 Mobilithon[177:60b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-06-05 16:15:04.412 Mobilithon[177:60b] THREAD WARNING: ['DeviceAuth'] took '14.641846' ms. Plugin should use a background thread.
2014-06-05 16:15:04.417 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init]
2014-06-05 16:15:04.632 Mobilithon[177:60b] THREAD WARNING: ['WLApp'] took '12.687988' ms. Plugin should use a background thread.
2014-06-05 16:15:04.644 Mobilithon[177:60b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-06-05 16:15:04.659 Mobilithon[177:60b] THREAD WARNING: ['DeviceAuth'] took '14.371826' ms. Plugin should use a background thread.
2014-06-05 16:15:04.662 Mobilithon[177:60b] [DEBUG] [NONE] Request [https://mobilithon-worklight.corp.com:443/worklight/apps/services/api/Mobilithon/iphone/init   


以下是对默认混合型应用程序文件所做的更改:
在initOptions.js:

var wlInitOptions = {
    …
     connectOnStartup : false,
     …
}
在index . html:

      <!--application UI goes here-->
       <img border="0" src="images/mcoe.png">
在main.js:

    var busyIndicator;
   function wlCommonInit() {       
       WL.Client.addGlobalHeader("Cookie", "AuthKey=foryoureyesonly");
       busyIndicator = new WL.BusyIndicator('',{text : 'Connecting...'});
       busyIndicator.show();
       WL.Client.connect(
       {
           onSuccess: onConnectSuccess,
           onFailure: onConnectFailure
       });
    }
    var onConnectSuccess = function()
    {
       // Go!
       busyIndicator.hide();
    };
    var onConnectFailure = function(error)
    {
       busyIndicator.hide();
       if(error==null) error = "No reason given";
       alert("Connection to server failed: " + JSON.stringify(error));
    }
 }

IBM提供的解决方法是通过document.cookie="…"

最新更新