Reputation: 417
I'm new to worklight and migrating worklight 6.2 to 8. I'm trying to connecting worklight using following code,
if (document.addEventListener) {
document.addEventListener('mfpready', function() {
WL.Client.init(wlInitOptions);
WL.Client.connect({ onSuccess: onConnectSuccess, onFailure: onConnectFailure });
angular.bootstrap(document, [ 'App' ]);
WLAuthorizationManager.obtainAccessToken()
.then(
function () {
console.log("*** Obtained token successfully.");
},
function () {
console.log("*** Failed obtaining token.");
}
);
}, false);
document.addEventListener('mfpjsloaded', function() {
WL.Client.init(wlInitOptions);
WL.Client.connect({ onSuccess: onConnectSuccess, onFailure: onConnectFailure });
angular.bootstrap(document, [ 'App' ]);
WLAuthorizationManager.obtainAccessToken()
.then(
function () {
console.log("*** Obtained token successfully.");
},
function () {
console.log("*** Failed obtaining token.");
}
);
}, false);
} else if (document.attachEvent) {
document.attachEvent('mfpready', function() {
WL.Client.init(wlInitOptions); });
}
function onConnectSuccess(result){
console.log("Success to connect worklight :"+JSON.stringify(result));
}
function onConnectFailure(result){
console.log("Fail to connect worklight :"+JSON.stringify(result));
}
But I got following error,
{"status":500,"statusText":"Internal Server Error","responseText":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>500 Internal Server Error</title>\n</head><body>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error or\nmisconfiguration and was unable to complete\nyour request.</p>\n<p>Please contact the server administrator,\n [email protected] and inform them of the time the error occurred,\nand anything you might have done that may have\ncaused the error.
and facing one more error,
static_app_props.js:3 Running static_app_props.js...
angular.js:107 ReferenceError: WLResourceRequest is not defined
Please guild me to resolve this issue. Thanks in advance.
Upvotes: 0
Views: 174