Click here to Skip to main content
15,867,750 members
Articles / Internet of Things
Article

Connecting to SAP Cloud Platform Internet of Things

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
24 Jul 2017CPOL3 min read 6.1K  
Connecting to SAP Cloud Platform

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

To get started using the SAP* IoT Starter Kit, you must first setup your account, by following the "Getting Started in the Cloud" steps listed at https://github.com/SAP/iot-starterkit#getting-started-in-the-cloud

SAP Cloud Platform* Developer signup

First, signup for an SAP Cloud Platform* Developer account. If you already have an account, you can skip to the next step.

Otherwise following the instructions at: https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/account

SAP* IoT setup

  1. Login to SAP

Login to your SAP Cloud Platform Cockpit at https://account.hanatrial.ondemand.com

  1. Enable Internet of Things

Next, enable the "Internet of Things" in your SAP Cloud Platform Cockpit.

Follow the instructions at: https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/service

  1. Create Device Information in Internet of Things Cockpit

To complete the needed prerequisites, you need to follow the following 3 steps:

  • Create a Message Type
  • Create a Device Type
  • Create a Device, and copy the generated Device Token. This is will be needed later to connect the Device.

Follow the instructions at: https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/cockpit

  1. Deploy the Message Management Service (MMS)

Once the configuration is defined, the last step is to deploy the Message Management Service. Make sure that you perform role assignment of the iotmms application to your user account.

Follow the instructions located at: https://github.com/SAP/iot-starterkit/src/prerequisites/mms

Summary

If you have followed all the steps above, you should have all the information that your program needs to connect to the SAP Cloud Platform Internet of Things:

application_url - The MMS endpoint application for your account. Located on the Java* Application Dashboard of your account for the SAP* Cloud Platform cockpit.

device_id - The device ID for the device you want to connect. Located on the Internet of Things Service Cockpit "Devices" page.

oauth_token - OAuth token for the device. This is the generated Device Token from the original setup. You can regenerate the token if needed on the Internet of Things Service Cockpit "Devices" page, using the "Authentication" tab for the device.

message_type_id - OutboundMessage Type ID. Located on the Internet of Things Service Cockpit "Message Types" page.

Additional setup for C++

When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you will need to use the RESTful client interface by setting the correct parameters in Eclipse*. To do that:

  1. Go to Run configurations and, in the Commands to execute before application field, type the following:

    export SAP_MMS_ENDPOINT="[application_url]/v1/api/http/data"; export SAP_DEVICE_ID="[device_id]"; export SAP_MESSAGE_TYPE_ID="[message_type_id]"; export SAP_OAUTH_TOKEN="[oauth_token]"
    
  2. Click the Apply button to save these settings.

  3. Click the Run button to run the code on your board.

Additional setup for JavaScript*

When running your JavaScript* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the REST interface, by setting the client parameters in the Intel® XDK IDE. Add the following entries to the config.json file:

 "services": {
   "sap": {
     "mms_endpoint": "[application_url]/v1/api/http/data",
     "device_id": "[device id]",
     "message_type_id": "[OutboundMessage Type Id]",
     "oauth_token": "[oauth token]"
  }
}

Additional setup for Python*

When running your Python* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the REST interface, by setting the client parameters. Add the following entries to the config.json file:

 "services": {
   "sap": {
     "mms_endpoint": "[application_url]/v1/api/http/data",
     "device_id": "[device id]",
     "message_type_id": "[OutboundMessage Type Id]",
     "oauth_token": "[oauth token]"
  }
}

Viewing data for debugging

You can monitor the state of the Message Management Service application deployed in the Java Application Dashboard of your account for the SAP Cloud Platform cockpit.

  1. Login to your SAP Cloud Platform Cockpit at https://account.hanatrial.ondemand.com

  2. Click on "Applications", then click on "Java Applications". This will display a new page with the list of Java applications.

  3. Click on the name "iotmms" in the list of applications. This will open the "iotmms - Overview" page.

  4. Scroll down the page to the section labeled "Most Recent Logging". Click on the eyeglasses icon next to the "HTTP Access Logs" log you want to view, and the most recent data should be displayed in a new tab.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
This is a Organisation

42 members

Comments and Discussions

 
-- There are no messages in this forum --