If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#52052 by Jaymer
Tue Nov 12, 2019 6:39 pm
TLDR - Tomcat was throwing a 403. Something in Tomcat config was messed up. We don't know what or why. Just replacing web.xml allowed connecting the first time.
Solution post here


Built an APK - very simple app.
But I cannot login.
I get the RED Mobile Login screen.
Anything I try, I get the "ALERT: Connection Failure. Status: error" popup

I've examined the embedded index.html (inside the phonegap upload) and the address is fine:
Code: Select allvar a = new MobileNative_LoginAction ($("#userName").val (), $("#password").val(), $("#domain").val(), $("#remember").prop("checked"), "http://111.222.41.218:8080/oem/");

And the domain is set correctly in the hidden field.
I can type in the URL and get to the server, so its not a firewall issue.

I get NO Activity shown in the Tomcat window. Have spent 2.5 hours dicking with this.
Any ideas?
I have someone who needs to use this TOMORROW in a warehouse - and I can't seem to get past step 1 Login.

thx
Last edited by Jaymer on Sun Nov 17, 2019 6:48 pm, edited 4 times in total.
#52056 by BobK
Tue Nov 12, 2019 8:33 pm
Have you tried to look at the logs on your android device? They might have more information about what the issue is.

I have never used phonegap, so I am only guessing that it does write to those files.
#52057 by Jaymer
Tue Nov 12, 2019 8:53 pm
thx, but
I'm not going to install Android SDK on this machine. Don't have rooted Phone. Cant view any logs. Tried 3 "logcat" apps - no luck.
#52060 by Jaymer
Wed Nov 13, 2019 5:48 am
Easily up to 10 hours now. And a high level of frustration also.

Support suggested I put some alerts in the HTML index.html that handles the login.
I did and that returned the expected URL of my server, and another heretofore unknown data element that gets passed to a program called
request.awmn.
The result of that (if successfully logged in) is the xml source code to "your app" - you can see this if you VIEW SOURCE after logging in to a BSV (starts around line 40).

So, an Aware Native app calls a local index.html file packaged by Aware when compiling the native app. You get the "red" logon screen, as seen in Vlad's video on building native apps.
When you submit, it calls a JS function, which then runs a function in "startupMobileNative.html" (which is packaged with the APK).
That does an AJAX call to the server with credentials.

i'm geting the "failure" condition. Msg is not much help. Basically, FU
I displayed the string being sent (user/passw/domain) and the server_URL.
All looked fine - one thing that can be messed up here is the default Aware directory/your custom directory. Or your port #. Its plain to see in the displayed string, and all looks fine in my case.

So i went to Postman, made a POST to the exact same server_URL and used raw mode to paste in that data string with the login info.
BAM!! Logs in no problem. I also tried a Android emulator on my laptop - no joy logging in through the APK. I'm on the same machine/network for all this, so its not a firewall issue on the server.

Supports only option is to sell me support for $120 if I want more help making this function work.
There's really not much to mess up here - sure, my 1st time I tried I had not published - so it was possible that very first time that it could not log on because I only had Test Mode available. Once I realized that, I made 20 more APKs from phonegap, all with minor variations, or tweaks now to the html (that started in bld 18). But even a dumb ass should have been able to get this working by now - after 10 hours, gimme a break.
#52107 by Jaymer
Sun Nov 17, 2019 6:46 pm
Using a Paid support hour, Vlad worked with me.

TLDR - Tomcat was throwing a 403. Something in Tomcat config was messed up. We don't know what or why. Just replacing web.xml allowed connecting the first time.

What did I learn:
1) If I would have remembered, I could have checked the Tomcat Log (not Aware's Tomcat Output / Server Output) and I would have seen the 403 errors.
2) During the support call, Vlad altered some code to have more descriptive error msgs from the login process.
Part of the "phonegap build" is the creation of "the red" login screen (as seen in the Building Native Apps in Aware video).
After <Submit> another JS routine is called. That file is \AwareIM\aware_kendo\mobileNative.js
Vlad had already had me put some alert lines there so I could see 2 variables that were being sent to the server.

In the run() function, I added 2 alerts before the AJAX call:
Code: Select all    run : function ()
    {
       var xmlStr = this.buildRequest ();
        var h = {};
        h ["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
       
      kendo.ui.progress ($(document.body), true);
      
        var me = this;
      //alert ("url: " + this.m_serverURL + 'request.awmn');
      //alert ("data :" + xmlStr);
        $.ajax ({


... but nothing was learned from that.

So Vlad added this loop in the Failure code of the AJAX call.
This is where we saw the 403 being returned, and then verified that in the Tomcat logs.
Code: Select all   // default connection failure
    failure : function (response, status)
    { 
      kendo.ui.progress ($(document.body), false);
         
       //alert ("Connection failed!  Status: " + response);
      if (! response)
         alert("Response is null");
      
      var property;
       for (property in response) {
         alert("Property " + property + " value: " + response[property]);
        }
    }


In retrospect, it would be more helpful if the Aware msg would have said something more that just "connection failure. Status:error". If it would have said "connection failure. Status 403 from server" then I'm sure it would have saved me 9 hours of frustration and $120. Well, not 100% sure. Because for whatever reason, Tomcat was rejecting the call from the phone, but not rejecting a login via Chrome. Chrome was coming in as a normal WEB connection, while the APK was an AJAX call to request.awmn.

Anyway, got it solved. I doubt someone else is going to have a corrupted/altered Tomcat config file that causes a similar failure. But hopefully this explanation will help someone else in the future.

Who is online

Users browsing this forum: Google [Bot], MSN [Bot], Rem and 23 guests