This is a migrated thread and some comments may be shown as answers.

jQuery ajax calls work in Graphite but not in MIST

13 Answers 135 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roger Rudenstein
Top achievements
Rank 1
Roger Rudenstein asked on 04 Jan 2013, 09:16 PM
My Incenium JQuery application contains a number of ajax calls to an asp page on a remote external server in order to populate various widgets in the app.  When I run the app in Graphite the calls work and the app is fine.  When I run the exact same app in Mist the calls are clearly not succeeding.  The error I am trapping is HTTP Error. The urls in the calls are all https.  My fiddler2 trace shows no authorization issues relative to our proxies.

I am vetting this product for OSRAM Sylvania Inc. and would appreciate any help you could give me in this matter. So far I am liking the product but this discrepancy gives me pause.

13 Answers, 1 is accepted

Sort by
0
Roger Rudenstein
Top achievements
Rank 1
answered on 05 Jan 2013, 02:48 AM
Here is the test code I am using.  It works ok on Graphite but fails to connect on Mist.

document.addEventListener("deviceready", onDeviceReady, false);

// PhoneGap is ready
function onDeviceReady() {
   // getLocation();
    alert("hello");
    url = "https://myLightpoint.sylvania.com/mbp/jquery/oe_test/db_hub5.asp?osi_emplid=009427&type=plan&plan=10" ;
 
    
   //  $.ajaxSetup({cache:false}); //this ensures that ajax will fetch the data each time IMPORTANT

      url = "https://myLightpoint.sylvania.com/mbp/jquery/oe_test/db_hub5.asp?osi_emplid=009427&type=dep&plan=10&data_request=list";   
          $.ajax({ 
            url: url, 
              error: ajaxError,
            cache: false 
            }).done(function( datax ) { 
              alert("hello again");
              }); //end get
}

function ajaxError(request, type, errorThrown)
{
   var message = "There was an error with the AJAX request.\n";
    switch (type) {
        case 'timeout':
            message += "The request timed out.";
            break;
        case 'notmodified':
            message += "The request was not modified but was not retrieved from the cache.";
            break;
        case 'parsererror':
            message += "XML/Json format is bad.";
            break;
        default:
            message += "HTTP Error (" + request.status + " " + request.statusText + ").";
    }
    message += "\n";
    alert(message); 
}
0
Yavor Georgiev
Telerik team
answered on 07 Jan 2013, 07:06 AM
Hi Roger,

 Because the Mist simulator runs in a browser, any apps you load into the simulator are subject to cross-origin security policies. Essentially, the browser loads your app from icenium.com and whenever you try to perform an ajax call to another site (in your case sylvania.com), the browser blocks it unless the target url is CORS compliant. You will need to make sure the url you're trying to access conforms to the HTTP access control spec.

 Apps running in the Graphite simulator and actual devices are not subject to cross-origin security restrictions and that's why you observe this problem in Mist only.

Regards,
Yavor Georgiev
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Roger Rudenstein
Top achievements
Rank 1
answered on 07 Jan 2013, 02:21 PM
Hi Yavor,

     Thanks for the explanation.   However, this leaves Icenium as useless to me since I am unable to consistently bring it up with my projects.  Graphite always comes up but it's a crap shoot whether or not it is going to include the menu items up top that allow you to access your projects.  The company I work for, OSRAM Sylvania Inc. maintains a typical corporate environment with proxy servers between our desktop PC's and the Internet.  Is there anything I can do to assure that Graphite will work consistently in our environment or is Graphite, at this stage, too buggy to expect consistency?  (I never have any trouble with Mist coming up but Mist is useless fpr my apps due to the Ajax call problem.)

Thanks,

Roger
0
Yavor Georgiev
Telerik team
answered on 07 Jan 2013, 02:38 PM
Hi Roger,

 Unfortunately Graphite has issues when running behind HTTP proxies that require authentication. We're working to diagnose and address those issues, but this will take some time.

 Right now the only remedy is to not use a proxy server that requires authentication. A plain proxy is fine, as long as it allows anonymous access.

 Again, because Mist runs in a browser, the browser handles all authentication with proxies and firewalls.

Kind regards,
Yavor Georgiev
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Roger Rudenstein
Top achievements
Rank 1
answered on 07 Jan 2013, 02:45 PM
Our proxies do not require authentication.   In my Fiddler trace I am seeing the proxies connect fine. This indicates to me that the problem is somewhere on your end.  You are not consistently handling the connectivity or authentication so that sometimes it works and sometimes it doesn't.    For example,  I was just going to include some of the Fiddler trace, so I brought up Fiddler and then Graphite...and Graphite came up with the project menus right away.  Whereas a half hour early when I tried it Graphite came up repeatedly without the menus.
0
Yavor Georgiev
Telerik team
answered on 07 Jan 2013, 05:03 PM
Hello Roger,

 This sounds very strange. If possible, could you please send us any Fiddler logs that could help us diagnose the issue to support at icenium.com?

Kind regards,
Yavor Georgiev
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Roger Rudenstein
Top achievements
Rank 1
answered on 07 Jan 2013, 06:44 PM
Yavor,

   I gets stranger.  After experimenting a bunch of times I can conclude now that Graphite works if Fiddler2 is tracing the http traffic.  If I leave Fiddler2 up but stop the tracing...I cannot successfully get Graphite to work.  But if I then resume the tracing and bring Graphite up again, it works!

   Somehow the FIddler2 tracing is making it possible for Graphite to find its menus.  So I have no trace to give you where Graphite does not work.  I will send you the trace where it does work if that will help.  Where do I sent the trace to?

0
Roger Rudenstein
Top achievements
Rank 1
answered on 07 Jan 2013, 07:10 PM
Looked in the logs and they are very short.  Here's the log from when I am able to connect:

[2013-01-07 13-46-53-68] Log (Info,None): Version 2012.3.1218.2. Deployment location https://app.icenium.com.
[2013-01-07 13-46-55-03] Log (Info,None): Logged in as: roger.rudenstein@sylvania.com

Here's the log for when the connect fails:

[2013-01-07 13-45-58-23] Log (Info,None): Version 2012.3.1218.2. Deployment location https://app.icenium.com.

0
Yavor Georgiev
Telerik team
answered on 08 Jan 2013, 10:48 AM
Hi Roger,

 Graphite works when Fiddler is capturing because Fiddler becomes the new HTTP proxy for all applications, including Graphite. Because Fiddler doesn't require authentication as a proxy server, Graphite can execute HTTP requests.

 Most probably your proxy server requires authentication, but, if you're logged in as a domain user and the proxy authorizes against your AD server, Windows handles authentication for you transparently.

 Graphite, however, can't access your Windows credentials and so it can't authenticate to the proxy server. We're looking into ways we can integrate with Windows authentication, or, failing that, show a username and password prompt when a proxy server requires authentication.

All the best,
Yavor Georgiev
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Roger Rudenstein
Top achievements
Rank 1
answered on 09 Jan 2013, 02:11 PM
A member of our team figured out how to work around this problem.  The solutions is to modify the  Icenium.Graphite.exe.config  file as follows:

Modify  <proxy usesystemdefault="True" />     
to
proxy usesystemdefault="True" scriptLocation="MyPacFile.pac"/>

The .pac file is used here to direct browsers to the correct proxies with the right authentication, etc.

You might expose this parameter and make it available in a popup dialog if connectivity fails.


0
Yavor Georgiev
Telerik team
answered on 09 Jan 2013, 03:10 PM
Hello Roger,

 Thank you, this is valuable insight. We will look into it.

Regards,
Yavor Georgiev
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Roger Rudenstein
Top achievements
Rank 1
answered on 09 Jan 2013, 08:15 PM
Whoops, spoke too soon.  I was so happy to have Graphite come up correctly after the above change that I hadn't gone all the way and run one of my projects.  When I did that this morning I find that the projects will no longer run in the simulator.   A blank simulator comes up with no content whatsoever.  I even tried your Hello World app and same thing.

I removed the reference to the .pac  script and tried the method of bringing up Fiddler2 first.  In that mode everything works fine.  But I am distrustful of the product for having to do this.  Clearly what is needed is a more robust fix.


0
Abdul
Top achievements
Rank 1
answered on 19 Jun 2013, 06:49 AM
Hi icenium Developer,

can u find below error.

XMLHttpRequest cannot load http://localhost:8080/rest/3.2/contactinfo/contactrest. Origin http://app.icenium.com is not allowed by Access-Control-Allow-Origin.

thanks and regards
muthalif
Tags
Report a bug
Asked by
Roger Rudenstein
Top achievements
Rank 1
Answers by
Roger Rudenstein
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Abdul
Top achievements
Rank 1
Share this question
or