Harold Gottschalk
Posts: 0
Joined: Wed Mar 27, 2013 9:42 pm

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

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

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

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

Harold Gottschalk
Posts: 0
Joined: Wed Mar 27, 2013 9:42 pm

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

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.

Harold Gottschalk
Posts: 0
Joined: Wed Mar 27, 2013 9:42 pm

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

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.

Harold Gottschalk
Posts: 0
Joined: Wed Mar 27, 2013 9:42 pm

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

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Return to “Issues”