cancel
Showing results for 
Search instead for 
Did you mean: 

[Kapsel offline odata] - store open issue

Former Member
0 Kudos

Hi,

I am trying to develop a offline mobile app using kapsel offline plugin in sap-webide[no local development].

I am following this blog for the same:

When I try to open the store after a successful user on-boarding,I get  the below error:

I checked the logs on the mobile services cockpit and it does not throw any error:-

Also, below is my backend configuration in the cockpit:

SDK and HAT installations are of latest version:-

Mobile SDK version - SPS12

HAT version - 1.14.4

Thanks in Advance.

Best Regards,

Deepak

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Deepak,

You had not selected 'Rewrite mode' to 'Rewrite URL to HCPms'  , try with this.

In Web IDE, did you select 'Kapsel offline template' ? , there you have to specify which collections (or all) you want that to be available offline.

Regards,

JK

Former Member
0 Kudos

Hi Jitendra,

I am having issues getting data using the odata calls I am making. Maybe that's the reason I am not able to open the store.

Whenever I try to make a call to the back-end, I get a "502 Bad Gateway Error". The call I am making is a simple odata read call to the following URL:

https://hcpms-p1942021492trial.hanatrial.ondemand.com/com.kapsel.webide/Products


When I use http instead of https I get "302 Found" but the result set is empty. Attaching screenshots for both

Its recommended to use https.

  


-----------------------------------------------------------------------------------------------------------------------------------------


I have changed my settings on hcpms to rewrite Urls.

My scenario is to build an hybrid app using oData offline plugin to store some data on the device and perform operations on the same data in offline mode[read, update, create]. I have selected "SAPUI5 Mobile Kapsel Starter Application" template for the same. Is it really necessary to chose an offline template. can't I change the device configuration and make the app work using the kapsel plugins.

Is it mandatory to rewrite URLs on HCPms. It asks for a "Relative path" as soon as I select this option. What is that all about?

Also, Please let me know more regarding the specifying of collections to be made available. In case any documentation is present, kindly point me to them.

I looked into the trouble shooting section and it mentioned this error might occur if I have given wrong store properties. I checked the values. can't see any difference from the one in the blog. Please check the snapshot:

I get the serviceRoot value from the project.json file. This is the same id with which the application is created in HCPms cockpit.

Currently I am using the open oData service for testing

I am pretty new to all this.will be really grateful for any help.

Best Regards,

Deepak

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

First of all, it should be HTTPS only.

  1. Coming to error message, Can you cross check if you are able ping application connection in HCPms cockpit?
  2. Are you able to view 'Products' collection directly by running OData url in a browser?

Increase log level to DEBUG for Component 'proxy' , look into HCPms logs for more analysis.

If this problem gets resolved, we can go for later part of above discussion.

Regards,

JK

Former Member
0 Kudos

Hi Jitendra,

1. when I ping the application below is the result:

2. I am able to view product collections directly from the browser. I have made the same call from my UI as well and it works.

I am attaching the log information. I have a doubt in the error line  "Response code from backend is 502 for request null#"

Hope this gets resolved soon with your help.

Best Regards,

Deepak

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Coming to my previous response, i wanted you to check if you are able to PING appid in HCPms cockpit? like

I closely looked at screenshot shared initially, seems there is a typo

You have entered: http://services.odata.org/V2/OData/OData.svc

Correct one: http://services.data.org/V2/OData/OData.svc

Hope this helps.

Regards,

JK

Former Member
0 Kudos

Thanks Jitendra,

This resolved my issue. was a typo issue indeed. Thank you for your patience and help.

Now the store opens successfully and everything works fine but when I try to go offline and execute the below statement:-

sap.OData.applyHttpClient();


it's throwing a error as below:-

window.OData not found. The datajs JavaScript library must be included with the application.

window.oData is undefined in the applyHttpClient().


I have created and run this app directly from the sap-web ide. Do I explicitly need to add data.js to the "www" folder? I checked the local cordova project created and the file is present in the location C:\Users\<UserName>\SAPHybrid\KapselTest\hybrid\www\resources\sap\ui\thirdparty/datajs-dbg] . Doesn't the plugin refer to this datajs file.

I also tried putting the file datajs.dbg.js in the www folder. It still throws the same error when I reload the app in flight mode. see the structure below:

Best Regards,

Deepak



Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Deepak,

To access an OData resource, you need to use JS library like datajs



Regards,

JK


PS: you have marked one of your comments as 'helpful answer' but actually it's not a helpful one.

Former Member
0 Kudos

It's all setup and working now.

Thank you jitendra for all your help.

Best Regards,

Deepak

Answers (0)