手动生成SOAP服务请求 [英] Manually Build SOAP service request
问题描述
我需要建立请求存储在谷歌App Engine的web服务的SOAP请求,因为平台,在这里我的工作不具备管理Web服务请求的库(我编程一个Arduino板)。
我SOAP服务器将存放在
I need to build a SOAP request for request a webservice stored on Google App Engine, because platform where i'm working doesn't have a library for manage webservice request (i'm programming an Arduino Board). My SOAP server it's stored at
http://arduino-data-server.appspot.com/
和我需要连接到服务器之前发送的请求。这是我的code:
and i need to connect to server before to send request. This is my code:
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");
}
}
everithing似乎是确定的,但我的服务器上,未检测到传入连接。怎么了?
everithing seems to be ok, but on my server, no incoming connections are detected. What's wrong?
在这里它是WSDL文件:arduino-data-server.appspot.com/FunctionsService.wsdl
here it is wsdl file: arduino-data-server.appspot.com/FunctionsService.wsdl
推荐答案
我觉得itisn't问题,但缺少一个>符号:
I think itisn't the problem, but is missing a > symbol:
client.println("<sendData xmlns=\"http://example.com/\"");
应该是:
client.println("<sendData xmlns=\"http://example.com/\">");
来自阿根廷问候
PD:我想用的Arduino做同样的,你
PD: I'm trying to do the same as you with arduino.
这篇关于手动生成SOAP服务请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!