on 09-15-2015 11:18 AM
Hi all,
I followed this guide
for creating a test app with the Kapsel and Cordova plugins through the webide template (master-detail Kapsel offline application). I've done all the walkthrough and installed all the necessary, the build from the HAT setup went fine and i created a basic app from the offline Kapsel template given on webide. I tested the app online and it worked, then i deployed with the specific command to local Hat. The path i followed for the offline part was using the HcpmsAdmin cockpit for dealing with the push-pull requests and the odata used, since it was only a test app was the dynamic session version from http://services.odata.org.
This is how i configured the Hcpms for the app part
The app was configured only for android.
Then from command prompt i went to the deployed project folder created in the SapHybrid folder and from there i launched the cordova emulate command for emulating the app. From there i took the apk created in \hybrid\platforms\android\build\outputs\apk and i installed it on my android device. The app launches and i can use it offline too (i created a new entry named "entered offline") but the problem is that when i go back online and press the refresh button it gives me a "failed to flush data back to server" error message and than the screen locks to busy state and remais like this till i kill manually the app.
The strange thing is that the new entry i added is already in the odata, so it means that the flush was done successfully.
I don't understand what i'm doing wrong? Creating the test app was only the first step because i wanted to use the offline functions for a custom app.
Help is much appreciated, and any ideas are welcome.
Thanks
Hi aklejdi
I could reproduce this issue. I am not sure about the root cause. I could find that this is not an issue with the kapsel offline template. Because it works when I am using a different odata service.
I doubt the recent requirement (from smp sp05) of the maxlength property in the key field of odata - it is mandatory to have a maxlength property in key property of odata as given below. Which is missing in the service you are trying with.
Regards, Midhun
SAP Technology RIG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
Thanks for answering!
The problem that i have 2 products with the id field equal to "9" is due maybe to the fact that i pressed twice the refresh button in two different moments in time. Maybe the BE service makes no checks for duplicate id-s and that allowed my app to post twice the same entry on the odata. I have noticed that the "triangle icon" on the upper right of the screen was there from the beggining and i don't if this is how it should be. By now i have made multiple tries (i repeated the procedure following this guide too: ), but i had the same results in every case.
I have tried to debug the app directly from my desktop chrome but it seems that i can inspect only code from my mobile chrome, when i opened the kapsel app chrome didn't gave me the option to inspect it.
This are some logs from the Hcpms Admin cockpit:
So... basically i made a new app from the begining to try this out because the old northwind session had duplicate entries. I tried out the new app following carefully these steps:
After that i checked the odata session and this is what i found:
Apparently i don't have any logs until now about this one on the hcpms.
Thank you for your efforts!
Best Regards
I changed only the first 2 tabs, as by instructions from this guide
The other tabs are as they were by default, i didn't change any configuration.
In webide-->device configuration i compiled only the name of the app (ProductsOffline), the appID (com.sap.offline), the version (1.0.0), in the Kapsel tab i checked only Logon Manager and Offline OData.
I selected the debug mode on the HAT local build options and only android platform on Platforms.
At last i put this on the HCPms host* : hcpms-p1941405286trial.hanatrial.ondemand.com
Hi Jamie,
I can't attach my .apk here like you requested because the file size is 25 MB and the editor allows me to attach max 1 MB and only certain types of file...
The only way i found to do that is by uploading it to an external site.
P.S. I don't know if i can post the link here
The link is this one: WeTransfer
It's only the code from the template app created by webide wrapped by cordova, i didn't change a single line in the code
Best regards,
Aklejdi
Ok sorry i thought you wanted the .apk. I'm exporting the project to a zip archive
but i have to give you an external link for this one too. The editor dosn't like .zip files
This is the link for the file:
Cheers
It looks like in your request you didn't submit a valid ReleaseDate. If you look at the service metadata it marks this field as nullable=false. I believe if there's a problem with the request, like the ReleaseDate field missing, between hcpms and the data source, hcpms will try to rerun the query, resulting in the duplicate entries. The northwind service shouldn't allow this to happen, but that's out of our control. Try submitting the request with a valid ReleaseDate, you need to obtain a new service url so you can successfully build a new offline store, duplicates will cause the store open to fail.
Regards,
Jamie
SAP - Technology RIG
Thanks for your efforts Jamie!
I didn't notice the release date wasn't nullable but i had my doubts and in the previous app i made, i filled that field with the correct format input, but maybe i did that try after a previous wrong try that probably ruined the session. I will try it one more time paying attention on doing the right things.. The only thing that i don't understand is why the app is so slow? Is that normal? Because if the app normally is that slow it's basically useless. If you can test the apk that i posted before you can see it by yourself.
Best regards,
Aklejdi
No, i tried in the emulator and it was even slower...Now i'm always using my phone to test the app and is so slow that if i tap the screen it reacts normally after 4-5 sec, sometimes it doesn't react at all. For input in edit mode i keep tapping the screen like 6-7 times for the keybord to open. That's why i'm saying that if the app was normally slow like this it would be useless..
After that i have bad news....the release Date wasn't the main problem, i made i new app with a new odata session and i had the same results as before, two entries with the same id. I don't understand why, maybe is related to the app slowlyness in my mobile. By the way, i have tested it in a galaxy S3.
Another test i made before adding a new entry (the first test with the new app) was editing an already existent one. In that case, after the edit (i edited only the name) when i pressed the refresh button everything resetted like before, and this proves that it's not the fault of the release date.
These is the new odata session after i added only one entry
I will try next week to use iOS for new tests.
Thanks for supporting me until now,
Cheers,
Aklejdi
Hi,
I ran some tests using the same service.odata.org service that you are using and think I was able to reproduce your issue.
This service appears to have a funny behavior that it tells you to use the URL:
http://services.odata.org/V2/(...)/OData/OData.svc
but after performing a POST operation, the Location header in the response has an URL like:
http://service.odata.org/(...)/V2/OData/OData.svc
Notice the "V2" has moved.
In my tests, the URL rewriting gear in the server was getting confused by this changed URL and resulted in a parsing failure that ultimately failed and rolled-back the entire flush.
But this failure while processing of the Location header happens after the request has been applied to the backend, which is why you are seeing duplicate POSTs in subsequent flushes.
So to make a long story short, the fix is to set the Backend URL in your HCPms application to be:
http://service.odata.org/(...)/V2/OData/OData.svc
On another note, it is true that this service seems to allow you to set non-nullable properties to null. If you create an entity that has a non-nullable property set to null then this will cause the OData Entity parser to fail during refreshes. You will have to DELETE any such entities from your service for it to refresh successfully (or simply create a new instance of the service)
Thanks,
- Adam
SAP - Development
Hi Adam,
Thanks for your response!!
I tried to change position of the "V2" like you said, and initially that worked. In the first 2 tries i firstly edited the first entry name, saved and refreshed and for the first time the refresh worked. Then i deleted 3 entries and even this one worked. then in the third test i tried a new entry and apparently this one went fine fine too(i copy-pasted from another entry the releaseDate-field to be sure for entering the correct format), but in this case smth strange happened when i refreshed, the odata resetted the 2 changes that i made before. From that point every test made went wrong, the refresh didn't work anymore, and the odata cancelled even the new entry i made after a while. I used a fresh-new odata session for that try. On the other hand i can't explain the extreme slowness of the app, like it was on the emulator...
Best regards,
Aklejdi
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.