I am trying to record temperature I get from the sensor into my SQL database using a ASP.net web service. I know my web service is working fine because I have written an application on ASP.net to test it and I see data recorded in my SQL database. For now, there is just a link to the action AddRow on the page you get when you go to www.XXXX:8080/Webservice.asmx and when you click on the link you get to a page where there is an invoke button and when you click on that a constant gets written to the database. When I try the same with my arduino code, I get the following but nothing gets written to the database:
⸮
Working to connect.Feather Huzzah ESP8266 & BME280 Temperature, Humidity, Pressure and Altitude Server
Connected to XXXX
IP address: 192.168.1.81
connecting...
X.X.X.X
disconnecting.
Soft WDT reset
ctx: cont
sp: 3ffef4d0 end: 3ffef6b0 offset: 01b0
stack>>>
3ffef680: 00000000 3ffee658 3ffee490 40201e3c
3ffef690: 3fffdad0 00000000 3ffee67c 402033c4
3ffef6a0: feefeffe feefeffe 3ffee690 40100718
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
I am connecting to WiFi and connecting to a remote server where the database is kept.
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Wire.h>
String z = "a";
IPAddress ip (192, 168, 1, 81);
IPAddress gateway (192, 168, 1, 1);
IPAddress subnet (255, 255, 255, 0);
//Internet Settings for
const char* ssid = "XX";
const char* password = "XX";
byte mac[] = { 0xEC, 0xFA, 0xBC, 0x05, 0xA4, 0x1A };
byte server[] = {X, X, X, X};
WiFiClient client;
void setup() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on by making the voltage LOW
Serial.begin(115200);
// Connect to WiFi network
WiFi.begin(ssid, password);
WiFi.config(ip, gateway, subnet);
Serial.print("\n\r \n\rWorking to connect");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Feather Huzzah ESP8266 & BME280 Temperature, Humidity, Pressure and Altitude Server");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("connecting...");
IPAddress server(X,X,X,X);
Serial.print(server);
if (client.connect(server,8080)) {
client.println(F("POST /WebService.asmx HTTP/1.1"));
client.println(F("Host: X.X.X.X:8080"));
client.println(F("Content-Type: text/xml; charset=utf-8"));
client.println(F("Content-Length: 350"));
client.println(F("Connection: close"));
client.println(F("SOAPAction: \"http://X.X.X.X:8080/webservices/AddRow\""));
client.println();
client.println(F("<?xml version=\"1.0\" encoding=\"utf-8\"?>"));
client.println(F("<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"));
client.println(F("<soap:Body>"));
client.println(F("<AddRow xmlns=\"http://X.X.X.X/webservices\">"));
client.println(F("</AddRow>"));
client.println(F("</soap:Body>"));
client.println(F("</soap:Envelope>"));
} else {
Serial.println("connection failed");
}
}
void loop() {
// put your main code here, to run repeatedly:
while(client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}