I have been using an ESP8266 board for a while to do internet Posts of data to a webservice that I created. I have been using the HTTPClient class to do this.
I am switching my project from WIFI to using Cellular using the MRK NB 1500 with a Verizon Sim card.
The only sample code that I have found for doing HTTP Posts is to build the entire post Using client.println functions. I have tried to get this to work, but so far have not had any luck getting the Posts to work. Here is basically what I am doing:
if (!client.connect(postServer, httpPort))
{
if (DEBUG_MESSAGES) {Serial.println("connection failed");}
LCDMsg = "PM:Conn failed";
return 0;
}
if (DEBUG_MESSAGES) {Serial.println("Body:"+postData);}
client.println(String("POST ") + resource + " HTTP/1.1");
client.println(String("Host: ") + server);
// client.println("Connection: close");
client.println("Content-Type: text/xml; charset=utf-8");
client.print("Content-Length: ");
client.println(postData.length());
client.println("SOAPAction: "" + MyServicePath + "/LogData"");
client.println();
client.println(postData);
If anyone had an Idea of what I am doing wrong, or if I can use something more like the ESP8266 HTTPClient class, please advice. Thanks in advance.