I am using a SIM808 with a atmega2560.
I have setup the endpoint in Azure and that works when I try a http post via postman and/or an online http post tool (I get a 202 as result and see data comming into Azure)
I want to send a json package to an Azure http endpoint (smart app) using the function httpPOST in the SIMCom library from itead.
I am connecting to the network:
logging (I printed all that is written to GSM):
AT+CIFSR
DB:STARTING NEW CONNECTION
AT+CIPSHUT
DB:SHUTTED OK
AT+CSTT="provider.net","","" DB:APN OK
AT+CIICR
DB:CONNECTION OK
AT+CIFSR
DB:ASSIGNED AN IP
GPRS status=ATTACHED
AT+CIPSTART="TCP","prod-13.westeurope.logic.azure.com",443
DB:RECVD CMD
DB:OK TCP
Then call the httpPost function from the library with the following variables:
const char server[35] = "prod-13.westeurope.logic.azure.com";
const int port = 443;
const char path[200] = "/workflows/someazureID/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=someazuretoken";
const char parameters[100] = "{\"device\":\"alive\",\"timestamp\":\"09270845\"}";
Part of the httpPost function from the library for sending the data
int InetGSM::httpPOST(const char* server, int port, const char* path, const char* parameters, char* result, int resultlength)
....
gsm.SimpleWrite("POST ");
gsm.SimpleWrite(path);
gsm.SimpleWrite(" HTTP/1.1\r\nHost: ");
gsm.SimpleWrite(server);
gsm.SimpleWrite("\r\n");
gsm.SimpleWrite("User-Agent: Arduino\r\n");
gsm.SimpleWrite("Content-Type: application/json\r\n");
gsm.SimpleWrite("Content-Length: ");
itoa(strlen(parameters),itoaBuffer,10);
gsm.SimpleWrite(itoaBuffer);
gsm.SimpleWrite("\r\n\r\n");
gsm.SimpleWrite(parameters);
gsm.SimpleWrite("\r\n\r\n");
gsm.SimpleWrite(end_c);
....
Which gives this output on the serial monitor (I printed all that is written to GSM):
AT+CIPSEND
DB:>
POST /workflows/someazureID/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=someazuretoken HTTP/1.1
Host: prod-13.westeurope.logic.azure.com
User-Agent: Arduino
Content-Type: application/json
Content-Length: 55
{"device":"alive","timestamp":"09270845"}
DB:SENT
And then it is waiting for a response:
Starting read..
Waiting for Data............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
CLOSED
Done..
response:
10
CLOSED
which times out I guess.
And I see nothing coming into Azure.
(I am getting data when I try a httpGet on a random site. So hardware, sim and network is working ok I guess)
Any ideas? thx!