Skip to Content
author's profile photo Former Member
Former Member

SAP IoT : Unable to send message using arduino board

Hi All,

I am trying to send data from Arduino UNO R3 board attached to arduino ethernet shield but I am facing some issues.

Below is my code which I am using on arduino board.

#include <Ethernet.h>

#include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

byte ip[] = { 192, 168, 0, 107 };

String data = "{\"mode\":\"async\", \"messageType\":\"1\", \"messages\":[{\"value\"=\"true\", \"timestamp\"=\"2015-06-30T01:30:30\"}]}";

const char Server[] = "https://iotmmss0014298301trial.hanatrial.ondemand.com";

const char Url[] = "/com.sap.iotservices.mms/v1/api/http/data/2f071193-41f9-4e2d-a0ee-108f7c797dde";

EthernetClient client;

void setup()

{

Ethernet.begin(mac, ip);

Serial.begin(9600);

delay(1000);

Serial.println("connecting...");

if (client.connect(Server, 80)) {

client.println("POST " + String(Url) + " HTTP/1.1");

client.println("Host: " + String(Server));

Serial.println("connected");

client.println("Authorization: Bearer a6af6518708c4f5d669eff8a2f34b44");

client.println("Content-Type: application/json;charset=utf-8");

client.print(data);

client.println();

} else {

Serial.println("connection failed");

}

}

void loop()

{

if (client.available()) {

char c = client.read();

Serial.print(c);

}

if (!client.connected()) {

Serial.println();

Serial.println("disconnecting.");

client.stop();

for(;;)

;

}

}

But there is arduino is unable to make connection to the IoT server link. (getting connection failed as error)

Please help me resolve this issue.

Regards,

Abhishek Bajaj.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2015 at 10:14 AM

    Hi All,

    I got the answer to the above question.

    SSL is not forced by the IoT Services but by HANA Cloud Platform. Every application deployed in HCP is only available via SSL.

    As arduino UNO R3 doesn't support SSL and if you want to use an Arduino on the edge, currently you probably need to stick to Arduino Yun. This board comes with an embedded Linux (OpenWRT) that can do SSL


    Thanks and regards,

    Abhishek Bajaj.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.