-1

I use the example LDAP Login with LDAP Server to connect my app with LDAP. I can connect the app example with the server. ALso I can modify the app and connect.

The problem is when I put the example in a Cordova Project for iOS when I put mfp as plugin.

I can see the app in _MobileBrowserSimulator and can connect to server but when I execute mfp cordoba emulate the app don't connect with server.

--- UPDATE ---

I use the same example that LDAP but this runs in mobile simulator but dont work in device. This is a simple example that run in simulator but not in device.

main.js

function getSecretData(){
var request = new WLResourceRequest("/Random/getInteger",
        WLResourceRequest.GET);


request.send().then(onSuccess, onFailure);
}


function onSuccess(r) {
   document.getElementById('guille').innerHTML = r;
}

function onFailure(r) {
     document.getElementById('guille').innerHTML = r;
}

index.js

function wlCommonInit(){
    WL.App.setServerUrl("http://127.0.0.1:10080/MyMFPProject",success, fail);
    WL.Client.connect();
}

function success(r){
    document.getElementById('guille').innerHTML = r;
}

function fail(r){
    document.getElementById('guille').innerHTML = "error: " +r;
}

function onSuccess(r) {
 document.getElementById('guille').innerHTML = JSON.stringify(r);
}

function onFailure(r) {
 document.getElementById('guille').innerHTML = JSON.stringify(r);
}
Guillermo81
  • 189
  • 11

1 Answers1

1

Update: based on the comment, it sounds like ATS is still enabled, in which requests will indeed fail. Disable ATS by adding the following to the application's *-info.plist:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>

Read more here: https://developer.ibm.com/mobilefirstplatform/2015/09/09/ats-and-bitcode-in-ios9/


The code looks fragile to me.
I would change it like below. If it will fail still then you need to create a test case demo of the failure. It sounds like it should fail also without anything related to LDAP...

function wlCommonInit(){
    WL.App.setServerUrl("http://127.0.0.1:10080/MyMFPProject",success, fail);

}

function success(r){
    document.getElementById('guille').innerHTML = r;
    WL.Client.connect({onSuccess: connectSuccess, onFailure: connectFailure);
}

function connectSuccess() {
    getSecretData();
    // ...
}

function connectFailure() {
    // handle connect failure
}

// the rest of the functions
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • Sorry for the bad code and discomfort. The problem is that the application fails in iOS9 but works well in IOS8. Thank you too! – Guillermo81 Nov 17 '15 at 14:16
  • Exists some way to modify the web.xml before MFP generates the WAR file? To add filter and filter mapping. – Guillermo81 Nov 18 '15 at 18:45