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

时间:2014-06-16 07:18:31

标签: ios ibm-mobilefirst

我的公司正在尝试Worklight 在企业网络内部设置试用WL服务器。

Internet上的设备必须通过外部防火墙到达WL服务器。防火墙接受到443的连接。来到此地址的任何https流量都反向代理到内部工作灯服务器,我们称之为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));
    }
 }

1 个答案:

答案 0 :(得分:0)

IBM提供的工作是通过document.cookie =“...”

设置cookie