Skip to Content
Author's profile photo Midhun VP

Get your hands dirty by trying Kapsel with SMP Cloud

Update: SMP 3 was released. HANA Cloud Platform mobile services (HCPms, cloud version of SMP) supports all Kapsel Plugins. HCPms replaced SMP on Cloud.

SAP Kapsel is a set of plugins for Apache Cordova (open source) that provides a subset of the capabilities provided by Hybrid web container, and it is replacing the HWC in SMP 3. ie SMP 3 will not have HWC apps, we have to use these plugins during the development of hybrid apps.

droid@screen-9.png

Since Kapsel is a part of SMP 3, and SMP 3 is not yet released I was looking for a way to test the Kapsel plugins and found it working with SMP on HANA cloud. But I am not sure whether all kapsel plugins are officially supported by SMP on Cloud since the cloud version has difference with on premise. If you are interested to try Kapsel Logon plugin in an Android device you can follow these steps.

Sign up for a free trial of SMP, cloud version: SAP HANA Cloud Platform

Register for NWGW trial, http://scn.sap.com/community/developer-center/netweaver-gateway

Download and install SMP 3 SDK (tested with SMP 3 SP01) from SAP Service Market Place

Install Cordova in your system (version 3.1.0-0.2.0), Apache Cordova

Create a cordova project

Create a new folder to keep the Kapsel projects.

Use the command cordova -d create C:\Kapsel_Projects\LogonDemo com.opensap.myfirst to create a new project.

Add the android platform to the project using the below command

cordova -d platform add android

ScreenHunter_89 May. 01 15.32.jpg

Add Kapsel plugins to the application

Make sure you are inside the project path and use the below command to add the Kapsel Logon plugin to your project.

cordova -d plugin add C:\SAP\MobileSDK3\KapselSDK\plugins\logon

ScreenHunter_92 May. 01 19.57.jpg

Replace www\index.html with the contents of index.html – Google Drive. (Note: This code sample is taken from Getting Started with Kapsel – Part 2 — Logon)

Prepare the project using the command cordova -d prepare

ScreenHunter_90 May. 01 15.41.jpg

Create application in SMP Cloud

Odata end point URL used, https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/

Application properties:

ScreenHunter_91 May. 01 18.30.jpgScreenHunter_92 May. 01 18.30.jpgScreenHunter_89 May. 01 15.03.jpg

Install Certificate in device for HTTPS

To make a HTTPS connection to SMP server a certificate needs to be installed in the device. Export the certificate from SAP on Cloud>paste it to device storage>install. More information on installing a certificate in Android device, Add SSL Certificate to Android

ScreenHunter_93 May. 05 11.15.jpgdroid@screen-1.png

Run the app !!

Finally, import the cordova project created to Eclipse IDE and run the app in an Android device.

droid@screen-2.pngdroid@screen-9.pngdroid@screen-5.pngdroid@screen-6.png

Find registered user in SMP cloud cockpit.

ScreenHunter_91 May. 01 18.26.jpg

Happy Hacking!!

Midhun VP

@midhunvptwit

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Basar Ozgur Kahraman
      Basar Ozgur Kahraman

      Enjoyed reading the blog ! Thank you..

      Author's profile photo Arun Santhanam
      Arun Santhanam

      Good one. All information about kapsel usage under one umbrella.

      Author's profile photo Former Member
      Former Member

      Nice blog Midhun !

      Great that SAP is also including KAPSEL (At least some of the plugins) in the Cloud version of SMP 🙂

      Author's profile photo Daniel Van Leeuwen
      Daniel Van Leeuwen

      The following document may also be helpful.

      Getting Started with Kapsel - Appendix J -- SMP Server Cloud Version

      Author's profile photo Parag Jain
      Parag Jain

      Hello Daniel,

      Would this be the same for native apps as well developed using SMP 2.3 / 3.0 SDK  with OData feed from backend ? I assume our existing SMP 2.3 SDK developed native apps would be able to work with SMP cloud version with some minor changes. Any guides to try that out like the one you created for Kapsel.

      Regards,

      Parag.

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      You can use the Odata SDK comes with SMP 2.3 with the SMP cloud too.

      Midhun VP

      Author's profile photo Parag Jain
      Parag Jain

      Great!!! Any experience around this ? Proof-of-Concept or a productive application ?

      Regards,

      Parag.

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      This might help you to understand how Odata is to connect with SMP on cloud from a native app. You can download the sample projects too,https://open.sap.com/course/mobile1

      Midhun VP

      Author's profile photo Former Member
      Former Member

      Hi,

      We are getting a error,while running app in android simulator,

      which is SAP is not defined in index.html,

      I have copied and pasted the code from index.html from

      index.html - Google Drive

      Please guide

      Regards,

      Lekhak patil

      Author's profile photo Daniel Van Leeuwen
      Daniel Van Leeuwen

      I would suggest checking to see which plugins have been installed into your project.

      In a command prompt change to the directory of your project (LogonDemo) and run

      cordova plugins

      This should list the plugin

      com.sap.mp.cordova.plugins.logon

      If it is not shown, try adding the plugin again

      cordova -d plugin add C:\SAP\MobileSDK3\KapselSDK\plugins\logon


      and make sure there are no errors shown.


      Another option would be to try use the Web Inspector to debug your page.


      Getting Started with Kapsel - Appendix B -- Debugging

      Author's profile photo Anilkumar Vippagunta
      Anilkumar Vippagunta

      Hi,

      We are getting below error. Pleast suggest ?

      I see the below plugins registered.

      C:\SMP\Kapsel_Project\Project>cordova plugin list

      com.sap.mp.cordova.plugins.corelibs 3.4.0 "CoreLibs"

      com.sap.mp.cordova.plugins.logger 3.4.0 "Logger"

      com.sap.mp.cordova.plugins.logon 3.4.0 "Logon"

      org.apache.cordova.console 0.2.9 "Console"

      org.apache.cordova.device 0.2.10 "Device"

      org.apache.cordova.inappbrowser 0.5.0 "InAppBrowser"

      Capture.JPG

      Regards, Anil

      Author's profile photo Former Member
      Former Member

      Hi Midhun,

      I have exactly followed the steps which is mentioned in your blog, but a difference is i have a SMP server running in my desktop. and i tried to connect with my mobile application both are in same network. I am getting lot of CORS error. Can you please help me on this.

      -Dinesh