I have developed an app using Sencha Touch 2.4.1 and built using Cordova 3.5.0-0.2.7 for Windows Phones. The app make https OData requests to a Server with valid and Trusted SSL certificate, but these requests are failing in WP8.1 with Status Code 0 and Status Text as blank.
It works fine with http protocol in WP8.1 and http/https in WP8.0 as well. Below is a sample code with two buttons-One calls HTTP service(Working) while another calls HTTPS service(Not Working):
{
xtype: 'button',
text: 'HTTP',
handler: function(b, e){
var storeRef = Ext.getStore('ODataStore');
storeRef.getProxy().setUrl("http://myDomain:80/SAP/Odata_Service");
storeRef.load();
}
},
{
xtype: 'button',
text: 'HTTPS',
handler: function(b, e){
var storeRef = Ext.getStore('ODataStore');
storeRef.getProxy().setUrl("https://myDomain:443/SAP/Odata_Service");
storeRef.load();
}
}
I think it has to do something with Cordova code. I've seen a few posts with similar problems but no concrete solution.
The problem came out to be very strange:
In first call, Windows Phone 8.1 is not allowing ‘https’ with ‘API Server Credentials’ passed in url . While, It’s allowing https without credentials or http with credentials.
Workaround:
I made a dummy call in start with https and no credentials, followed by normal https calls with credentials. It worked!