/wp-content/uploads/2015/02/sap_logo_333927.png

Appendix M:  SAP HANA Cloud Platform Mobile Services(HCPms)

The samples written for this guide were developed and tested against the SMP 3.0 server on premise version.  This section will demonstrate how Kapsel can be used with SAP HANA Cloud Platform Mobile Services(HCPms) and point out a few differences.  For information on the older cloud offering see the appendix SMP Server Cloud Edition.

One benefit of using software in the cloud is that with just a few clicks, an instance of the software is ready to be used.  By comparison the download for the SMP 3.0 server install is over 2 GB and can take a while to download and install.  In general a server that is hosted in the cloud will automatically have patches applied to it, have backups taken, handle failover, and have hardware capacity added or removed as needed.  When the server is in the cloud, depending on the setup, individual developers may have less access to configuration files, log files and changes made by one developer could affect all others using the shared server.

One of the first differences seen between the cloud and on premise versions of the server is that the management cockpit is different.  It is Fiori based.

Another difference is that the management cockpit and the host used to access the server are different.  The following is an example of the URL used for the management cockpit.

https://hcpmsadmin-i82xxxxtrial.dispatcher.hanatrial.ondemand.com/sap/mobile/admin/ui/home/index.html

The following is the host name used to connect to the server from within the app.

hcpms-i82xxxxtrial.hanatrial.ondemand.com

One more difference is that the user name and password to access the HCPms server is your SAP Community Network user name and password or possibly an SAP supplied client certificate.

See also SAP HANA Cloud Platform Mobile Services Released, How to Enable HANA Cloud Platform Mobile Services Trial and Setting up an SAP HANA Cloud Platform Mobile Services Developer Account.

The following sections provide some examples and guidance for Kapsel plugins that interact with the HCPms.

Registering
Logon Plugin and Proxied Data
AppUpdate
Push
Logging
Offline
SAP Fiori Client

Registering

  • Open the Mobile Services Cockpit.
    image0.PNG
  • Click on Applications, then click on the + icon in the bottom toolbar.
    Create a new Application with an application ID of
    com.mycompany.logon

    and a name of

    Logon Demo

    The type should be Hybrid and the Security Configuration can be set to None.

    image1a.PNG

    Provide the following URL for a Backend URL.

    http://sapes1.sapdevcenter.com:8080/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/

    Set the Authentication Type to be Basic Authentication and provide the user name and password to access the Backend URL.
    The proxy type can be No Rewriting or Rewrite URL on HANA Mobile Server
    Select Proxy Type Internet since this URL is a publicly available URL as opposed to one that is only available internally on a corporate network.
    image1.PNG

  • Register against this server in Chrome using register.html from the Logon section.
    Remember to place a copy of datajs-1.1.2.min.js in the same directory as register.html.
    Change the getSMPURL method to use HTTPS and port 443.
    Also change the value for the SMP Host to be the URL for your server instance such as hcpms-i82xxxxtrial.hanatrial.ondemand.com.
    image5.PNG

    The registrations for the application com.mycompany.logon can be examined by clicking on the Home icon > Registrations and Users > Application ID (All) > Application ID (com.mycompany.logon).
    image2.PNG

Logon Plugin and Proxied Data

  • In order to use the Logon plugin to register against an SMP server that uses HTTPS, the mobile device or simulator will have to trust the certificate that the server is using.  The certificate authority used by a particular HCPms server can be seen by examining the site in a Chrome browser as shown below.
    image3.PNGimage4.PNGimage6.PNG

    Note, the Baltimore CyberTrust Root is installed by default on Android and iOS devices and emulators.

  • If your network uses a proxy to access the internet, you may need to set a proxy for your device or emulator so that it can access the HCPms server.  See also Proxy Setting for Android.
  • Create or reuse a project similar to the one shown in the Logon section.  Modify the serverHost variable to point to the name of the server hosting the HCPms, use port 443, and https=true.
    In the management cockpit for the backend notice that the following URL which uses HTTP rather than HTTPS is used.
    http://sapes1.sapdevcenter.com:8080/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT

    If you do wish to use HTTPS, the following instructions may be helpful.  How to use HTTPS Connections with SMP Cloud.

    Deploy and run the project.
    image7.PNG

App Update

The steps for using the AppUpdate plugin are essentially the same between the on premise and cloud server.  Follow the instructions from the AppUpdate section of the guide and make sure to change the host, port and https settings in index.html to match the values used for your HCPms server.

"serverHost": "hcpms-i82xxxxtrial.hanatrial.ondemand.com", //Place your SMP 3.0 server name here
"https": "true",
"serverPort": "443",

Also, when running the kapsel deploy command make sure to change the servername, port, user name and password.

kapsel package
kapsel deploy com.mycompany.appupdate hcpms-i82xxxxtrial.hanatrial.ondemand.com:443 i82xxxx mypassword

Note that the there is a bug that prevents the above command from working in SP08 and SP08 PL01.  This has been reported as BCP issue 1570459959 and should be corrected in SP08 PL02.  A workaround is to use the management cockpit to deploy the zip file rather than using hte kapsel deploy command.

Note that when using the kapsel deploy command in SP08 and SP08 PL01 the staged version (if there is one) is set to be the current version rather than the version being deployed.  This has been reported as BCP issue 1570460186

The Management Cockpit can also be used to deploy the zip file generated by the kapsel package command.  Under App Specific Settings, choose Upload Kapsel and then once uploaded, select it and choose Deploy.

image8.PNG

In the above screenshot, the app with a deployment version of 1.0.5 is currently deployed to all users.  The newer version could be made available as a staging version to testers by clicking on the stage link.  Once it has been tested, it could then be deployed for all users.
To enable a user to receive staged versions, go to Registrations and Users, select the user and enable the Is Tester toggle.

Push

Follow the instructions from the Push section of the guide and make sure to change the host, port and https settings in index.html to match the values used for your HCPms server.  One difference is how a user is assigned to the Notification User role.  This is the user name and password that is allowed to send a notification from the HCPms server to the registered devices.

Open the SAP HANA Cloud Platform Cockpit

https://account.hanatrial.ondemand.com/cockpit

Click on Services
Under SAP HANA Cloud Platform Mobile Services, click on the Roles icon
Click on Roles, select the Notification User role and assign your user id to the role.
Note, it may take some time before this setting takes effect.

image9.PNG

image9b.PNG

The following is an example of sending a notification to an app that has registered with the HCPms server.  image11.PNG

Logging and Settings

Follow the instructions from the Logger section of the guide and make sure to change the host, port and https settings in index.html to match the values used for your HCPms server.  The uploaded log files can be viewed under Logs > Logs and Traces.  Various filters can be set to help find the uploaded log entry such as filtering by the application ID and by type.
image10.PNG

Follow the instructions from the Settings section of the guide to enable the log level of the application to be set by the management cockpit and the settings plugin.

Offline

Follow the instructions from the Offline section of the guide and make sure to change the host, port and https settings in index.html to match the values used for your HCPms server.

The following issues might be seen while trying this sample.
Read fails after update while online 1570142176
Refresh takes 66 seconds after an update and Flush 1570035288
The HCPms server version can be seen on the Home screen of the Management Cockpit.  The above two issues were seen using version 1.1.0.0, build 20150522-0806.

SAP Fiori Client

Follow the instructions from the SAP Fiori Client section of the guide and make sure to change the host, port and https settings in index.html to match the values used for your HCPms server.  Note that the Fiori Demo URL cannot be used when proxying through either the on premise or HCPms server.  This has been reported in https://jtrack/browse/NGPBUG-15747 and appears to be a problem with sending a host header (which is used by the option Rewrite URL on Backend) to the backend server.

Back to Getting Started With Kapsel

To report this post you need to login first.

12 Comments

You must be Logged on to comment or reply to a post.

  1. Jens Glander

    Hi Daniel,

    Thank for your helpful descriptions how to use/configure HCPms.

    To your Registering section:

    I could register a user to my own HCP mobile service on Trial.

    Two questions:

    1. On my ‘Registration and Users’ page I can see after the registration a new line like in your screenshot above. But why is the ‘User Name’ column empty? (Same in your screenshot)
    2. I tried to register a second user via register.html with different User ID/password. As result I get the strange JavaScript alert: “Already Registered”!? Could you explain this behaviour?

    Thank you for your help.

    Best Regards, Jens

    (0) 
    1. Jens Glander

      to 2) sorry I should have looked into the register.html code:

      appCID is stored in window.localStorage.

      > After clearing the localStorage (e.g. window.localStorage.clear()) I could register a second user. 

      Regards, Jens

      (0) 
      1. Daniel Van Leeuwen Post author

        As to your first question, if you change the security configuration from none to basic and then use your SCN credentials when registering, I believe the user name will then be displayed.  I think the user name is empty because a security configuration of none was selected.

        Hope that helps,

        Dan van Leeuwen

        (0) 
        1. Jens Glander

          Hi Daniel,

          thanks for your fast reply.

          I changed the security configuration from none to basic but still User name column of the two registered users is empty.

          (btw is ‘User Name’ == ‘User ID’? Or is ‘User Name’ perhaps a separate user attribute which is not set yet?)

          Best regards,

          Jens

          (0) 
          1. Daniel Van Leeuwen Post author

            I am not sure why but I had troubles saving the change from security configuration none to basic.

            I had to log out and log back in before it would successfully save the change.  I guess something timed out.

            Once it was saved and I verified it by trying to login with an incorrect user name and password which failed and then entered my scn user id and password which succeeded. 

            After that I could go to the registrations and users screen and see that User Name matched the value entered in the username field of the registration screen.

            Note that the previously registered users would still be empty as they were registered using the None configuration.  It would just be new registrations that were made once the security configuration was set to basic that would appear.

            Dan

            (0) 
            1. Jens Glander

              Hi Dan,

              well, when I try to register a new user with BASIC configured HCPms setting I get an Unauthorized error (Request Method:POST, Status Code:401 Unauthorized, …)

              Switching back to NONE and it works again.


              Any idea how to get this fixed?


              Thanks a lot, Jens.


              Ps: As admin of my HCP mobile service I would like to see registered user names also for secu auth none setting (or is the entered user name from the register.html not stored when the user is created?)

              (0) 
              1. Daniel Van Leeuwen Post author

                I am not sure what your SAP or SCN user name and password values are … if you think you have forgotten them, I think there is a link where you can reset the password.  See the end of this post for details on that.

                How to enable HANA Cloud Platform Mobile Services Trial

                My understanding from trial and error is that if the security configuration is set to none, the user name appears as “” in the management cockpit.

                (0) 
                1. Jens Glander

                  Hi Dan,

                  I don’t know why you think that I forgot my SCN user name/password (I’m quite familiar with HCP development and I know my used p-user and password).

                  I just said that I switched to BASIC configuration j(your suggestion) and after that used the register.html to register another user for my HCPms service. But that failed with Status code 401.

                  In your case it seems work, in my case not.

                  Thanks and Regards,

                  Jens

                  (0) 
  2. Michael Appleby

    Hi Josep-Manuel,

    Please open a Discussion marked as a Question.  Also suggest that you read the documentation in the Getting Started link at the top right of the page, especially the Rules of Engagement.

    Regards, Mike (Moderator)

    SAP Technology RIG

    (0) 

Leave a Reply