0

I made simple application. Added android and desktopbrowser environments. Android app works fine.

While preview desktopbrowser environment getting Error Access Denied Reload dialog box infinite times.

Made below two changes in "worklight.properties" file.

mfp.session.independent=false

mfp.attrStore.type=HttpSession

Tried with restarting server and eclipse as well.

Code to reproduce below:

function wlCommonInit(){

    WL.Client.connect({
                onSuccess: onConnectSuccess,
                onFailure: onConnectFailure
            });

}

function onConnectSuccess(){
    alert("Connected to Server");
    WL.Client.checkForDirectUpdate();

}

function onConnectFailure(){
    alert("Connection Failure");
}

$("p").click(function(){
    alert("Paragraph Clicked");
    getData();
});

function loadFeedsSuccess(result){
    invocationResult = result.invocationResult;
   alert(JSON.stringify(invocationResult.firstName));
   alert(JSON.stringify(invocationResult.lastName));
}

function loadFeedsFailure(error){
   console.log("Feed retrieve failure");
   alert(JSON.stringify(error));
   alert("Feed retrieve failure");
}


function getData() {
    var invocationData = {
            adapter : 'Test',
            procedure : 'getAdapter',
            parameters : []
        };

    WL.Client.invokeProcedure(invocationData,{
        onSuccess :  loadFeedsSuccess,
        onFailure : loadFeedsFailure,
    });
}
  • When you use the chrome inspector do you see any issues in the javascript console? – Chevy Hungerford Apr 08 '16 at 19:18
  • FWIW, I was able to copy/paste the above code into a freshly created MFP 7.1 hybrid app with a desktop browser environment (by putting it in main.js), made the indicated changes to worklight.properties, and in my environment it works correctly. It might be interesting to see what's in the development server logs (under your Eclipse workspace directory in "MobileFirstServerConfig/servers/worklight/logs). – patbarron Apr 08 '16 at 20:12
  • 1
    Console am getting as : wlclient init started before: initOptions.onSuccess Request [/Test/apps/services/api/Test/desktopbrowser/init] Application details header: {"applicationDetails":{"platformVersion":"7.1.0.0","nativeVersion":""}}WL.Logger.__log @ after: initOptions.onSuccess wlclient init success http://vishalps-macbook-pro.local:10080/Test/apps/services/api/Test/desktopbrowser/init Failed to load resource: the server responded with a status of 403 (Forbidden) – RAJENDRA PRASAD S.J Apr 09 '16 at 05:53
  • can you change your host name to your actual ip address and test again? – DoraC Apr 11 '16 at 01:03

1 Answers1

1

I cannot reproduce this.

  1. Created a new project in IBM MobileFirst Platform Studio 7.1.0.00-20160321-2138
  2. In server\conf\worklight.properties I have set mfp.attrStore.type=HttpSession and mfp.session.independent=false
  3. Added the Mobile Web environment
  4. Added code for WL.Client.connect() in main.js -> wlCommonInit()
  5. Run As -> Run on MobileFirst Development Server
  6. Preview in Console

I got a dialog showing "success" (the success callback of onSuccess).

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • Thank you Idan. Again I tried same. This time I added Mobile Web environment along with desktopbrowser. But still getting same error in both environments. Am using IBM MobileFirst Platform Studio 7.1.0.00-20160401-2103 which is available in eclipse market place. Please let me whether am I working in wrong version of Mobile First Studio. – RAJENDRA PRASAD S.J Apr 09 '16 at 05:50