Jump to content

sending a POST message over SSL

Recommended Posts

I am trying to talk to the Microsoft Azure Event Hub from Energia but I'm a little baffled!


Using the WiFi library I seem to be getting a successful connect (returns true) but ... nothing seems to get posted...


I am trying to build the message up as in this (javascript) example http://fabriccontroller.net/iot-with-azure-service-bus-event-hubs-authenticating-and-sending-from-any-type-of-device-net-and-js-samples/ but not seeing anything (even failed messages) reported in the event hub.


I wanted to stick with Energia rather than switch to anything else, but after a couple of days banging my head on a wall I'm a little suck! Any ideas would be much appreciated (as I'm probably doing something dumb!)


if there's a way to debug this / get error messages from the connection or the attempt to post that would be a huge help...


Gotta use the Azure end point for this, so that's the one constant.


char sas[] = "SharedAccessSignature {sig from the generation example}";
char serviceNamespace[] = "{ns}.servicebus.windows.net";
char hubName[] = "{hub}";
char deviceName[] = "device01";

void loop() {

    WiFiClient client;
    float t = 10.1;

  // if there's a successful connection:
  if (client.connect(serviceNamespace, 443)) {
    // send the HTTP POST request:
    client.print("POST /");
    client.println("/messages HTTP/1.1");
    client.println("Host: www.arduino.cc");
    client.println("Content-Type: application/atom+xml;type=entry;charset=utf-8");
    client.print("Authorization: ");
    client.print("{ Temperature: ");
    client.println(" }");

    // note the time that the connection was made:
  } else {
    // if you couldn't make a connection:
    Serial.println("connection failed");


Share this post

Link to post
Share on other sites

It's .sslConnect, not .connect to do SSL.


Another user was having trouble connecting to Azure Event Hub with .sslConnect BTW.  I was able to confirm this behavior but still have no idea why it's happening.  Probably requires a deep dive that I don't have time to do (i.e. spin myself up on what Microsoft's SSL restrictions might be, what the CC3100/3200 supports, etc...)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now