Web services 手动生成SOAP服务请求

Web services 手动生成SOAP服务请求,web-services,google-app-engine,soap,arduino,Web Services,Google App Engine,Soap,Arduino,我需要为存储在Google App Engine上的Web服务构建SOAP请求请求,因为我工作的平台没有用于管理Web服务请求的库(我正在编写Arduino板)。 我的SOAP服务器它存储在 在发送请求之前,我需要连接到服务器。这是我的代码: char server[] = "www.arduino-data-server.appspot.com"; //server address WiFiClient client; if(client.connect(server, 80)) { Se

我需要为存储在Google App Engine上的Web服务构建SOAP请求请求,因为我工作的平台没有用于管理Web服务请求的库(我正在编写Arduino板)。 我的SOAP服务器它存储在

在发送请求之前,我需要连接到服务器。这是我的代码:

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");
  }
}
char server[]=“www.arduino-data-server.appspot.com”//服务器地址
无线客户端;
if(客户端连接(服务器,80)){
Serial.println(“连接到服务器,准备请求”);
client.println(“POST/dataserver HTTP/1.1”);
client.println(“主机:http://arduino-data-server.appspot.com");
println(“内容类型:text:xml;charset=utf-8”);
client.println(“SOAPAction:\”http://example.com/getData\"");
客户。println(“”);
客户。println(“”);
客户。println(“”);

client.println(“我认为这不是问题,但缺少一个>符号:

client.println("<sendData xmlns=\"http://example.com/\"");

client.println(“问题是我缺少POST方法的“content lengh”body属性。如果该字段不正确或缺少,服务器将不处理http数据包。只需在单独的函数中生成http body,这样您就可以计算长度属性并将其附加到请求中
client.println("<sendData xmlns=\"http://example.com/\">");