Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
mgrasshoff
Advisor
Advisor

Hi there.

SAP Mobile Platform Enterprise Edition, Cloud Version is available for almost half a year now. Also the trial version is accessible for many months. With the openSAP course "Introduction to SAP HANA Cloud Platform", which also covers SMP Cloud (not the official name, but much shorter) the interest in SMP Cloud is much higher than before. In this course (Week 6, Advanced Topics) I show a quick demo how to set up the SMP Cloud and use it to run a mobile Web App. One aspect that is not really visible there is, that each device (in this case it is the browser) has to be registered (also referred as "onboarding") in order to access the data of the backend. This is a quite simple task for an app if you know how to do it. This following How-To should demonstrate how it is done. To make it more interesting for anyone I will explain it and you can follow each step by yourself in a second browser window.

So prepare yourself to use SMP Cloud with Copy & Paste.

Disclaimer: I am willing to help you if something is broken and you can't follow the steps for some reason. But answers will be given on a best effort base only. I will do what I can, but I can't provide 24/7 support here.

Please spend a couple of minutes to do your first steps with SMP Cloud. Well, obviously you need some prerequisites to start. So please make sure that you have the following ready at hand:

  • You need Google Chrome on your machine.
  • Please install the Postman Plugin, which allows creation of manual REST calls. You get the Plugin for Chrome from its Chrome Web Store.
    Alternatively you can use the RESTClient in Firefox.
  • Also, please register for a HANA Cloud Platform trial account if not done already.
    You can do it here: https://account.hanatrial.ondemand.com
  • We need a backend service to consume. NetWeaver Gateway is providing some sample services and we should leverage them. Create a user for the sample services here: http://scn.sap.com/docs/DOC-40986 or more directly here: https://supsignformssapicl.hana.ondemand.com/SUPSignForms
  • Make sure that you can access the backend service using your browser. Check you Email to see which is the initial password being set. Usually it is "Initial123", but please check your Email.

Now we have everything we need. We have a device (simulated by the Chrome Postman Plugin), we have a backend OData service, and we have credentials to call the OData service. Finally we have a SMP Cloud trial account.

The overall steps we will process are like this:

  1. Create an Application in SMP Cloud
  2. Register a Device (onboard)
  3. Retrieve data from the backend via SMP Cloud

  1. Create an Application in SMP Cloud
    1. Start the SMP Cloud Admin UI using the HANA Cloud Platform Cockpit: http://account.hanatrial.ondemand.com/cockpit in a new browser window.
    2. On the left Content pane, click Services
    3. Now click the link to Mobile Platform, enterprise edition, cloud version. A new tab opens and you are now in the Admin console of SMP Cloud.
    4. Click on Applications on top of the Admin console.
    5. The list of Applications is empty and we want to create a new Application Configuration so click the New button.
    6. A dialog pops up. Provide “firstApp” as ID and your name as Name.
    7. Click Save.
    8. A new dialog appears. In the backend tab, copy the following link to the Endpoint textbox: http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/
      This is your sample backend service.
    9. Set Connect to to Internet. This is important because it tells SMP Cloud where your service can be found.
    10. Select the Authentication tab on top of the dialog.
    11. Put in “mySecurity” in the Security Profile Name textbox.
    12. The section Authentication Type contains a textbox asking for a Authentication URL. Put again the URL of the backend in this textbox.
      http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/
    13. Select “Internet” for the Connect to radio box.
    14. Click the Save button and confirm.
  • o. This concludes the SMP Cloud configuration.
  1. Register a Device (onboard)
    1. Start Chrome and open the Postman plugin
    2. Copy this to the adress bar in Postman:
      https://smp-{accountname}.hanatrial.ondemand.com/odata/applications/latest/firstApp/Connections
      Please substitute {accountname} with the Hana Cloud account name for your trial account. Typically it has the format of Sxxxxxxxxtrial.
    3. Set the HTTP method from GET to POST.
    4. Click the Basic Auth tab on top of the Postman.
      1. Put in your username and password for the backend service.
      2. Click Refresh headers.
      3. Click the Headers button right besides the POST URL.
      4. Add Content-Type header to the value “application/atom+xml; charset=UTF-8”. Check that you have the Content-Type header and the Authorization header listed here.
      5. Click the raw button below.
      6. h. Paste the following XML to the POST body:

<?xml version='1.0' encoding='UTF-8'?>

<entry xmlns='http://www.w3.org/2005/Atom' xmlns:d='http://schemas.microsoft.com/ado/2007/08/dataservices' xmlns:m='http://schemas.microsoft.com/ado/2007/08/dataservices/metadata'>

  <content type='application/xml'>

<m:properties>

<d:DeviceType>Windows</d:DeviceType>

    </m:properties>

  </content>

</entry>

  1. i.      We have now everything in place to register our “device”. Click the Send button. You should see something like this:

....

<content type="application/xml">

<m:properties>

<d:ETag>2013-02-07 13:46:10.0</d:ETag>

<d:ApplicationConnectionId>a5d9041d-3a90-48c6-b00f-9952a4eaeacd</d:ApplicationConnectionId>

<d:AndroidGcmPushEnabled m:type="Edm.Boolean">false</d:AndroidGcmPushEnabled>

<d:AndroidGcmRegistrationId m:null="true"/>

<d:AndroidGcmSenderId></d:AndroidGcmSenderId>

<d:ApnsPushEnable m:type="Edm.Boolean">false</d:ApnsPushEnable>

<d:ApnsDeviceToken m:null="true"/>

  1. This is the response of a successfull registration request. It contains the ApplicationConnectionId. This information is very crucial for the subsequent step, so please copy it to your clipboard and into a textfile. This ID will be different for each registration, so obviously it will not exactly be the same like the one shown above.
  2. Retrieve data from the backend via SMP Cloud
    1. Now click the Reset button of the Postman plugin (the tiny little one on the right side of the browser window).
    2. Copy the this URL to the address bar of  Postman:
      https://smp-{accountname}.hanatrial.ondemand.com/firstApp
      Again, make sure you substitute {accountname} correctly.
    3. Add the headers for Authorization as done before. Provide the same backend credentials.
    4. Add a custom header X-SMP-APPCID and provide the APPCID from your clipboard as value.
    5. Click the Send button.

Congratulations!! You have just retrieved your first data using SMP Cloud. You can now play around and issue more OData requests. Just append OData queries to the GET URL. For instance https://smp-{accountname}.hanatrial.ondemand.com/firstApp/ FlightCollection?$format=xml

So, next steps would be easy. Just code this registration process into your App. If it's an HTML5 App or a native App - the process is always the same here.

Also there are more things to do with SMP Cloud, this is just the beginning. If you want to read more, don't hesitate to read the manual, you will be surprised how useful this can be. You can find the manual here: https://help.hana.ondemand.com/mobile/frameset.htm

Have Fun,

Martin Grasshoff

11 Comments