Skip to Content

1. Summary

In this blog, I’m going to show you how you can use the SAP HANA Cloud Connector and the IoT Message Management Service together.

Therefore I’ll start with a fictional scenario so you can imagine why one would want this. Followed by a step-by-step guide how to achieve it and how to test.

2. The Scenario

You have an amazing IoT Application up and running, but it’s running in your datacenter and not in the cloud. Of course, you want to move to the cloud, because the cloud is awesome, we all know.

Some months fast forward, you developers did an outstanding job and most of your software components are now ready to run in the cloud. But some components, which are only needed to process the data from the first generation of your device, are not and you don’t want to move them to the cloud because the device almost reached EOL.

Of course, you decided to use the SAP Cloud Platform and its IoT Service.
You’re using the IoT MMS as a router for any incoming message and some of those messages (green arrows in the diagram) should be sent to your legacy system while the rest (blue arrows) is consumed directly in the cloud.

3. Scope

I will cover:

  • How to configure the SAP HANA Cloud Connector for the described scenario.
  • How to configure the IoT MMS for the described scenario.
  • Testing.

I won’t cover:

4. Preparation

4.1 Processing Service

You’ll need a message processing service inside your corporate network. For the seek of this blog, it is not necessary that your processing service does anything meaningful with the data, this can be added later.
It can be basically anything which is able to understand an HTTP POST request. e.g.:

  • A LAMP or XAMP instance
  • A Java EE Container
  • Some ABAP Code
  • If you just want to test out the possibilities, you can use this python code. It starts an HTTP Server and accepts HEAD, GET and POST requests. Except logging the requests to standard output, it does nothing. Because it’s the most generic option to follow I’ll use this one. If you decide to use another option and experience problems, first try this “default” option before commenting, it will help me or other readers to understand your problem and provide solutions.

4.1 IoT Service

You’ll need at least one message type, one device type and one device configured in the IoT MMS (see Message Management Service Documentation).
To test your setup, you will need a way to generate some messages. You can either use a physical device like a Tessel or just generate messages using the web interface of the IoT MMS.
Because using the web interface is the most generic option to follow I’ll use it. If you decide to use another option and experience problems, first try this “default” option before commenting, it will help me or other readers to understand your problem and provide solutions.

5. Let’s do it

5.1 Add a system mapping to SCC

  1. Make sure your processing service is running. If you’re using the provided python script with the default port you can check it by accessing this URL: http://localhost:8000. Also, check the log.
  2. Add a system mapping as shown in the screenshot below.
  3. If you’re using the provided python script use the following settings. Otherwise, adapt them to match your needs.
    HTTP
    localhost
    8000
    iotprocessingservice
    8000
    None
    Something meaningful
  4. You should now see a new entry listed at Mapping Virtual To Internal System.
  5. I recommend checking if the cloud connector can reach your processing service. To do so, use the icon highlighted in the screenshot below.  If the check succeeds, you should see a HEAD request in your log.
  6. Click the + Icon next to Resources Accessible On iotprocessingservice:8000 and fill the upcoming popup like shown below and click Save.

5.2 Add a Message Consumer to the IoT MMS

  1. Open your Message Management Service Cockpit.
  2. Select the Configure Processing Service Mappings Tile
  3. Select the Mapping for the Device Type and Message Type of which the data should be sent to your OnPremise Processing Service or create a new one, if you haven’t created one before.
  4. Press the Add Processing Service Button and select http
  5. On the next screen, configure the following settings (anything not shown up in the table can be left at default values):
    mms.processing.http.proxy_enabled true
    mms.processing.http.proxy_host localhost
    mms.processing.http.proxy_port 20003
    mms.processing.http.send_mode messages
    mms.processing.http.url http://iotprocessingservice:8000
  6. Press Add HTTP-Header and use “SAP-Connectivity-ConsumerAccount” as Header Name and the name of your account as Header Value
  7. Click Back to Mapping Page and then Save.

Update 03/16/2017: I was asked the question where the proxy port and host values come from via Email. They are available in the environment variable HC_OP_HTTP_PROXY_HOST respectively HC_OP_HTTP_PROXY_PORT as documented here https://help.hana.ondemand.com/help/frameset.htm?d872cfb4801c4b54896816df4b75c75d.html. Currently, these values are set to localhost and 20003 on every SAP Cloud Platform landscape (without guarantee), but this might change in the future and break the connection. Do not use this productively yet, it is a proof of concept. I’ll update this post as soon as I found an appropriate solution, feel free to comment and if you plan to use this productively so I can keep you updated.

6. Testing

Now it’s time to generate some test data and keep an eye on the log to see if the messages get delivered as supposed.

  1. Go back to the initial screen of your Message Management Service Cockpit.
  2. Select the Messaging through HTTP Tile
  3. Change the values in the red boxes so that they match your configuration.
  4. Click Send
  5. Now check the Reply from Server Section. It should look similar to the following:
  6. Also, check the log of your Processing Service. It should look similar to this:

7. Versions

I’m running:

  • SAP HANA Cloud Connector 2.9.0.2
  • Message Management Service 2.35.0
  • Python 2.7.11
  • Windows 10.0.10586
  • Google Chrome 56.0.2924.87
To report this post you need to login first.

3 Comments

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

  1. Moya Watson

    Nice to see your blog, Philipp! Thanks for sharing this along with the clear use case of moving an IoT app up to the cloud.   By “SCC” you mean Cloud Connector I presume?

    (0) 
  2. Aakanksha Gupta

    Hi Phillip,

    Nice blog.

    I followed all the steps. But getting this response.

    T_IOT_PROCESSING_SERVICE_CONFIG table is filled with these values:

    Not sure where I am making a mistake.

    Please guide.

     

    Thanks,

    Aakanksha

    (0) 

Leave a Reply