我需要构建一个 SOAP 请求来请求存储在 Google App Engine 上的网络服务,因为我正在工作的平台没有用于管理网络服务请求的库(我正在编写一个 Arduino 板)。我的 SOAP 服务器存储在
http://arduino-data-server.appspot.com/
我需要在发送请求之前连接到服务器。这是我的代码:
char server[] = "www.arduino-data-server.appspot.com"; //server address
WiFiClient client;
if(client.connect(server, 80)) {
Serial.println("Connected to server, preparing request");
client.println("POST /dataserver HTTP/1.1");
client.println("Host: http://arduino-data-server.appspot.com");
client.println("Content-Type: text:xml; charset=utf-8");
client.println("SOAPAction: \"http://example.com/getData\"");
client.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
client.println("<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("<soap:Body>");
client.println("<sendData xmlns=\"http://example.com/\"");
client.println("<temperatura> 22 </temperatura>");
client.println("<umidita> 55 </umidita>");
client.println("</sendData>");
client.println("</soap:Body>");
client.println("</soap:Envelope>");
client.println();
Serial.println("OK");
}else {
Serial.println("KO");
}
}
一切似乎都很好,但在我的服务器上,没有检测到传入连接。怎么了?
这是 wsdl 文件:arduino-data-server.appspot.com/FunctionsService.wsdl