Page 1 of 2

Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 5:24 pm
by Harold Gottschalk

Having an issue and it is acting as if it running via the proxy.


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 5:25 pm
by maxkatz

Proxy is not used when running as hybrid app (as it's not needed)


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 6:13 pm
by Harold Gottschalk

Max, I believe there may be a bug related to the proxy now on the device. We had an issue the proxy did not work correctly if we used https, but on phone it was not an issue. We would use http and proxy on the web simulator and then once we build to the device change it to https and it worked as expected.

Now it is acting as if we have the same problem as on the web. We are tying to debug your code and now the services are in a separate file not in our main.js as before the last the update. The service.js is using the http://appery.io/app/rest/tunnel as the url, in the service code does this get ignored?

I am running an older version of my before the update and it work fine, with the new generated code it does not work with https: any more.


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 7:32 pm
by Harold Gottschalk

I've pretty much confirmed that you are pushing my calls via the proxy, the code that is being generated for the new settings.js file appears to be incorrect. Can you have your debug team check this out?

The code generator is not disabling the proxy and tunnels me.
I looked at the settings for services prior to Builder Update and the new settings files and they are produced differently.

The other item is why do you have two settings.js files in the project. 1 has older project info then the other, it is locate in a totally different place too.


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 8:29 pm
by Harold Gottschalk

Code produced Prior to last Update

var Zebit_Post_Login_Service = new Appery.RestService({
'url': '{zurl}{zapi}user/login/?format=json',
'dataType': 'json',
'type': 'post',
'contentType': 'application/json',

Code: Select all

 'serviceSettings': zSettings 

ZebitLoginService = new Appery.DataSource(Zebit_Post_Login_Service, {
'onComplete': function(jqXHR, textStatus) {

Code: Select all

         $t.refreshScreenFormElements("j_590"); 
     }, 
     'onSuccess': function(data) { 
         zApiLogin(data) 
     }, 
     'onError': function(jqXHR, textStatus, errorThrown) { 
         if (errorThrown == "Internal Server Error") { 

             zConfirms(zErrMsg.INTERNAL_ERROR_MSG, zErrMsg.INTERNAL_ERROR_TITLE, ZebitLoginService, "makeCallAgain"); 
         } else { 
             zAlerts(zErrMsg.LOGON_EXCEPTION_MSG, "Ok", zErrMsg.LOGON_EXCEPTION_TITLE); 
         } 

         localStorage.setItem("zLoginSuccess", "false"); 
         localStorage.setItem("zmaUserLoggedIn", false) 
     }, 
     'responseMapping': [{ 
         'PATH': ['api_key'], 
         'ID': '___local_storage___', 
         'ATTR': 'zApikey' 
     }, { 
         'PATH': ['customer_id'], 
         'ID': '___local_storage___', 
         'ATTR': 'zCid' 
     }, { 
         'PATH': ['sessionid'], 
         'ID': '___local_storage___', 
         'ATTR': 'zSessionId' 
     }, { 
         'PATH': ['success'], 
         'ID': '___local_storage___', 
         'ATTR': 'zLoginSuccess' 
     }, { 
         'PATH': ['customer_id'], 
         'ID': '___local_storage___', 
         'ATTR': 'zCidHash', 
         'TRANSFORMATION': function(value, element) { 
             return String(new Date().valueOf()).concat(value); 
         } 
     }], 
     'requestMapping': [{ 
         'PATH': ['username'], 
         'ID': 'mobiletextinput1_46', 
         'ATTR': 'value' 
     }, { 
         'PATH': ['password'], 
         'ID': 'mobiletextinput1_47', 
         'ATTR': 'value' 
     }] 
 }); 

 datasources.push(ZebitLoginService); 

In the Code after the Update:

var Zebit_Post_Login_Service = new Appery.RestService({
'url': 'http://appery.io/app/rest/tunnel',
'dataType': 'json',
'type': 'post',
'contentType': 'application/json',

Code: Select all

 'serviceSettings': zSettings 

});

Code: Select all

  ZebitLoginService = new Appery.DataSource(Zebit_Post_Login_Service, { 
     'onComplete': function(jqXHR, textStatus) { 

         $t.refreshScreenFormElements("Zebit"); 
     }, 
     'onSuccess': function(data) { 
         zApiLogin(data) 
     }, 
     'onError': function(jqXHR, textStatus, errorThrown) { 
         if (errorThrown == "Internal Server Error") { 

             zConfirms(zErrMsg.INTERNAL_ERROR_MSG, zErrMsg.INTERNAL_ERROR_TITLE, ZebitLoginService, "makeCallAgain"); 
         } else { 
             zAlerts(zErrMsg.LOGON_EXCEPTION_MSG, "Ok", zErrMsg.LOGON_EXCEPTION_TITLE); 
         } 

         localStorage.setItem("zLoginSuccess", "false"); 
         localStorage.setItem("zmaUserLoggedIn", false) 
     }, 
     'responseMapping': [{ 
         'PATH': ['api_key'], 
         'ID': '___local_storage___', 
         'ATTR': 'zApikey' 
     }, { 
         'PATH': ['customer_id'], 
         'ID': '___local_storage___', 
         'ATTR': 'zCid' 
     }, { 
         'PATH': ['sessionid'], 
         'ID': '___local_storage___', 
         'ATTR': 'zSessionId' 
     }, { 
         'PATH': ['success'], 
         'ID': '___local_storage___', 
         'ATTR': 'zLoginSuccess' 
     }, { 
         'PATH': ['customer_id'], 
         'ID': '___local_storage___', 
         'ATTR': 'zCidHash', 
         'TRANSFORMATION': function(value, element) { 
             return String(new Date().valueOf()).concat(value); 
         } 
     }], 
     'requestMapping': [{ 
         'PATH': ['username'], 
         'ID': 'mobiletextinput1_46', 
         'ATTR': 'value' 
     }, { 
         'PATH': ['password'], 
         'ID': 'mobiletextinput1_47', 
         'ATTR': 'value' 
     }, { 
         'PATH': ['appery-proxy-url'], 
         'HEADER': true, 
         'ATTR': '{zurl}{zapi}user/login/?format=json' 
     }, { 
         'PATH': ['appery-key'], 
         'HEADER': true, 
         'ATTR': '1372701726279' 
     }, { 
         'PATH': ['appery-rest'], 
         'HEADER': true, 
         'ATTR': '2096790' 
     }] 
 }); 

 datasources.push(ZebitLoginService); 

As you can see you are producing the proxy code.


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 8:31 pm
by Kateryna Grynko

Hi Harold,

Could you please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and tell us the app name? We'll need some time to test this issue.


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 8:37 pm
by Harold Gottschalk

sent email shared already


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 8:39 pm
by Kateryna Grynko

Thank you. What is the app name?


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 8:41 pm
by Harold Gottschalk

boomerang


Proxy for rest services is it disabled automatically when running on the device?

Posted: Mon Jul 01, 2013 8:42 pm
by Kateryna Grynko

I'll test and update.