How to on-board user with HANA Cloud Platform mobile services
I was excited to hear the announcement about HANA Cloud Platform mobile services trial availability. This is a great opportunity to the developer community to try the solution for free. HCPms is the cloud version of SAP Mobile Platform. SAP had another cloud version of SMP called SAP Mobile Platform, enterprise edition, cloud version it was deprecated.
Even there are few differences between SMP on-premise (SMP 3) and HCPms the mobile SDK is common for both, ie. an app written for SMP 3 runs against HCPms too without any code change – that caught my attention. Here I am going to run one of my existing hybrid mobile app developed for SMP 3 against HCPms.
Prerequisites
Apache Ant should be installed and added to path
Android SDK – It also requires Java
Cordova – Version is 3.6.3-0.2.13
Configure Application in HCPms
From the HCPms admin cockpit (https://hcpmsadmin-<your HANA account user name>.dispatcher.hanatrial.ondemand.com/sap/mobile/admin/ui/home/index.html) click on Applications> Click on Add icon on the bottom bar and provide below details:
Application ID : com.kapsel.logon
Name: com.kapsel.logon
Type: Hybrid
Security Configuration : Basic
Optionally provide Description and Vendor.
Click on Save.
Next, click on Backend and provide the below details.
Backend URL : http://services.odata.org/V2/OData/OData.svc/
Authentication Type: No Authentication
Save the configuration.
Develop Hybrid Mobile App
Follow this blog to develop a kapsel logon based hybrid app. Replace index.html with index.html. Only change needed to run the app with HCPms is providing the HCPms host and port.
Run cordova command:
cordova prepare
Connect phone with PC using USB and execute the cordova command:
cordova run android to run the app in the device.
Offline a Demo
Adding offline functionality to a hybrid app is quite easy using Kapsel plugins. Following the blog Getting Started with Kapsel Offline OData I have added the offline plugin to the app for a small demo.
- Download datajs file and place it in www folder
- Replace index.html with index.html
- Execute below commands from the project path to add the offline plugin.
cordova -d plugin add com.sap.mp.cordova.plugins.odata
cordova plugin add org.apache.cordova.network-information
Happy Coding !
Midhun VP
Dear Midhun VP,
thank you for the walk through. I followed your steps and was able to register the app I've built using you sample. I thought I had to publish my app, but the publish failed with an error. So now let's try the next step and call a OData service. Have you already tried to use the OData off-line functionality?
Best regards
Gregor
Hi Gregor,
I just added the code for Odata offline. Hope that helps.
Regards, Midhun
SAP Customer Experience Group - CEG
HI Gregor,
The "publish" button, exposes the App configuration to Mobile Secure (if you have connected your Mobile Secure Account to HCPms) and let you create Apps, which are able to retrieve the inial HCPms URL from mobile secure, resulting in an Application start where the user does not have to put it any configuration. He just logs on and uses the app.
-Martin
Hi Martin,
does the Trial Account supports Mobile Secure?
Best regards
Gregor
Hi Gregor,
yes, in the sense that the Discovery Service is working in the Trial - as I mentioned in my blog, there is almost no technical limitation.
Anyhow, you need a separate Mobile Secure trial.
Both systems needs to exchange some "secrets" in order to communicate. This is described in the documentation.
-Martin
Hi Marting,
is there any guide for connecting Mobile Secure Account to HCPms?
thanks,
Billy
Hello Midhun,
Thank you very much for the update.
Quoting you - "HCPms is the cloud version of SAP Mobile Platform. SAP had another cloud version of SMP called SAP Mobile Platform, enterprise edition, cloud version it was deprecated."
So what are the new capabilities (and/or deprecated capabilities like SMS services, perhaps) that come with HCPms. Could you please guide me to some knowledge source?
Thanks in advance!
Regards,
Utsav Chobe
Utsav Chobe
Check the HCPms official release SAP HANA Cloud Platform Mobile Services
Hi Utsav,
As I mentioned in the blog, app written for SMP 3 runs in HCPms without any code change.
HCPms replaces SMP, enterprise edition, cloud version. You can find more details here:SAP HANA Cloud Platform mobile services released
You can find the documentation of HCPms here:SAP HANA Cloud Platform Mobile Services
Regards, Midhun
SAP Customer Experience Group - CEG
Thanks Jitendra and Midhun!
Regards,
Utsav Chobe
Hi Midhun VP,
thanks for this content. Now I have to find a new topic for my upcoming document.
This was exactly what I wanted to demonstrate next.
Perfect!!
Regards,
Martin
Thanks for sharing, we are just moving to HCPms and learning the mechanism of HCPms.
I'm looking forward to read more from you.
--
Thanks and regards.
Patton Li.
Hi Midhun,
Thanks a lot for the blog. It's very useful.
I've followed you example for offline app connect to HCPms. It was working fine on the first run last week but when I tried it again today, it return an error
"
An error occurred "[-10204] Communication with the server failed with status code: 500""
Do you have any clue if this is an issue on the server side or it's something to fix on the js code?
Hi Thanit,
As "HTTP 500" corresponds to "Internal server error". There might be few reasons for this error.. e.g. something web wrong on server side but server cant give more specific info on what the exact problem is.
I guess, you should create a new discussion at SMP Developer Center > start a discussion
and share the steps you followed with screenshots.
Regards,
JK
Hi Midhun,
In your blog you said at this section:
Develop Hybrid Mobile App
Follow this blog to develop a kapsel logon based hybrid app. Replace index.html with index.html.
The link for index.html isnt working for me. Would you mind sending me the contents of the file or checking the link?
Thank you
Hi Jared,
The link is working, I just checked.
Since it's not working for you I am pasting it here:
Regards, Midhun
SAP Technology RIG
Hi Midhun VP,
Thanks for your sharing. I have created LogonDemo and used iOS simulator to register successfully.
My question is how to configure my LogonDemo application in HCPms to use my on-premise LDAP Server as a cloud user store or or how to configure it by using kapsel deploy command.
I have already had cloud connector and configured it to use our LDAP AD. And, the destination/backend connection of onpremiseumconnector has been defined also.
The reference is Configuring User Store in the Cloud Connector.(SAP HANA Cloud Platform). It gave an neo command for JAVA applications.
Thanks for your help.
Best Regards,
Iris
Hi Midhun,
Thanks for the post!
By pressing the button "Register" i got the error:
sap is not defined, where calling the method sap.Logon.init .
Any idea what my mistake is?
Regards,
Georgi
Hi Georgi,
Could you double check whether you added the Logon plugin using the command cordova -d plugin add com.sap.mp.cordova.plugins.odata
Regards, Midhun
SAP Technology RIG
Hi Midhun,
I've added the Logon plugin by typing: cordova -d plugin add C:\SAP\MobileSDK\KapselSDK\plugins\logon ,
typing the cordova -d plugin add com.sap.mp.cordova.plugins.odata in the cmd got an Error: 404 Not found : com.sap.mp.cordova.plugins.odata
Just checked by typing cordova plugins and got response :
com.sap.mp.cordova.plugins.logon 3.5.0 "Logon"
Regards,
Georgi
Hi Georgie,
You should be able to add the required kapsel plugins. Please follow this blog: Getting Started with Kapsel - Part 2 -- Logon and use replace the index.html wiith the one I given. Sorry the logon plugin command is cordova -d plugin add com.sap.mp.cordova.plugins.logon
You are getting the above mentioned error because the required plugins are missing in your project.
Regards, Midhun
SAP Technology RIG
I've just added the odata plugin and its dependencies - corelibs and AuthProxy.
But now I'm getting the error "cannot call method 'init' of undefined" of the same code line
Ok, hopefully I was able to fix the plugin error, but now i got another one :
The page at "file://" says:
ERROR in(line#0): Script error.
🙂
Hi Georgie,
Could you provide the steps you followed also relevant screen shots.
Regards, Midhun
SAP Technology RIG
Hi Midhun,
- codova -d create D:\Path com.kapsel.logon KapselLogon
- cordova platform add android
- cordova -d plugin add D:\Path-to-logon-plugin"
-cordova -d prepare
- added the other plugins and its dependencies (odata, corelibs, authproxy)
My app in the HCPms:
Hi Georgie,
When you are creating project you have to mention the SMP SDK kapsel plugins path too.
Ex.
cordova -d create C:\Kapsel_Projects\LogonDemo com.mycompany.logon LogonDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
Regards, Midhun
SAP Technology RIG
Hi Midhun,
I have enabled my HCP Mobile server and configured an application in the Cockpit.
I want to authenticate my username and password against the gateway username and password while onboarding.
According to this document, https://help.hana.ondemand.com/hana_cloud_platform_mobile_services/SAP_HANA_Cloud_Platform_Mobile_Services.pdf, I found that I have to enable SCIM service if I want to authenticate with the backend while onboarding.
Is it possible to enable SCIM service for trial account?
If possible, then how to do that?
Do I have follow some steps(like creating destination in Cloud Platform Cockpit) after enabling SCIM service?
Thanks,
Dhani
Dear Dhani,
you can use the SAP HANA Cloud Connector also with the HCP Trial. But before using it in a customer environment get permission from the security officer. But you can try the Cloud Connector at home and use my Project gregorwolf/hanatrial-auth-proxy · GitHub to use i.e. a HANA XSODATA Service for your tests.
Best regards
Gregor
Hi Gregor,
Thanks for your reply.
I will try with your project for authentication.
I have already used the SAP Cloud Connector to connect to my on-premise backend.
So do you mean to say that right now we cannot enable SCIM service for trial account?
Thanks,
Dhani.
I have the same question.
I have an application in HCPms and SAP Cloud Connector already to
a. exposing backend services, and
b. having corporate LDAP as an user store
For user authentication, should I enable SCIM service? And, how it could be implemented at mobile app side, via Client Hub and Kapsel Logon Plugin?
Hi Dhani,
as you can use the Cloud Connector also for the Trial Landscape it's absolutely possible to use an SICF (That is the correct name of the transaction) Service.
Best regards
Gregor
Hi Gregor,
Thanks for the info.
Can you please tell me how to use this service?
Regards,
Dhani
Hi Midhun VP,
Thank for your helpful description how to use HCPms together with mobile Kapsel applications.
Together with two SCN blogs from Daniel Van Leeuwen (http://scn.sap.com/docs/DOC-49524 and http://scn.sap.com/docs/DOC-62109) and your blog I managed finally to run the Logon Kapsel application on my android device and I registered a user on my Trial HCPms account by means of this app (using BASIC and NONE security types, both worked).
But for my HCPms on landscape hana.ondemand.com the user registration does not work with the same Kapsel Logon application when using BASIC security type configuration for the Kapsel Logon app in HCPms UI.
The NONE security type configuration worked also on hana.ondemand.com, i.e. in that case users could be registered.
But I want to registered secured users which are connected to the account and the HCPms service by a SAML-configuration of an SAP Cloud IdP (SCI) which is connected already to my account.
Do you have an idea what might be the reason why the BASIC secu type (I also tried FORM, i.e. SAML but failed as well) does not work in the described situation?
Thank you very much for any help on this issue.
Best regards,
Jens
Hi,
I've just figured out that my Kapsel Logon App I mentioned in my last comment also works on my hana.ondemand.com HCPms account with security type BASIC.
What was my mistake?
My HCPms account on hana.ondemand.com is connected to SAP Cloud IdP (SCI), so I thought that the users which could register via the Logon Kapsel App are the users defined in the SCI.
But this seems not to be the case by default: Still the SAP IdP (i.e. SCN users) is the relevant users store for registering authenticated users.
I will ask a new question in the forum (see here) how to change my HCPms so that my SCI (and not SAP IdP) is taken as basis for users to be registered.
Best regards,
Jens