the full code it's specific for my application, so you need to modify it 
for your purpose. If you have some doubt try to do some reversing: just 
create a SOAP web client (as showed on tutorial) and sniff related http 
packet for see the right structure that your request shuuld have.

void doPost(String temperature, String humidity) {
  String body = HttpRequestBody(temperature, humidity);
  Serial.println("Preparing connection to server");
  if(client.connect(server, 80)) {
    Serial.println("Connected to server, sending request.");
    //Send HTTP POST request
    client.println("POST /dataserver HTTP/1.1");
    client.println("Accept: text/xml, multipart/related");
    client.println("Content-Type: text/xml; charset=utf-8");
    client.println("SOAPAction: 
\"http://example.com/Functions/sendDataRequest\"";);
    client.println("User-Agent: Arduino WiFiShield");
    client.print("Content-Length: ");
    client.println(body.length());
    client.println("Host: arduino-data-server.appspot.com");
    client.println("Connection: Close");
    client.println();
    client.println(body);
    client.println();
    client.stop();
    Serial.println("Request sent");

String HttpRequestBody(String temp, String hum) {
  String res = "";
  res += "<?xml version=\"1.0\"?>\n\r";
  res +="<S:Envelope 
xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n\r";
  res +="<S:Body>\n\r";
  res +="<ns2:sendData xmlns:ns2=\"http://example.com/\";>\n\r";
  res +="<arg0>"+temp+"</arg0>\n\r";
  res +="<arg1>"+hum+"</arg1>\n\r";
  res +="</ns2:sendData>\n\r";
  res +="</S:Body>\n\r";
  res +="</S:Envelope>";
  
  return  res;
}




Il giorno sabato 28 dicembre 2013 22:39:19 UTC+1, Carlos Bologna ha scritto:
>
> Hi!
>
> Can you show me your code? I made the same thing that you said, but it 
> doesn't work for me yet. 
>
> Thanks!
>
> Em quarta-feira, 9 de outubro de 2013 04h26min45s UTC-3, giuseppe giorgio 
> escreveu:
>>
>> Ok, i've solved my problem. first of all i've build separate function for 
>> generate xml message. In this way i could calculate the exact length of 
>> http body. 
>> And a note for who will try to do something like me. When you need to 
>> assign value to Content length attribute, avodi to code like
>>
>> client.println("Content-Length:"+body.length());
>>
>>
>> but do it in the correct way
>>
>> client.print("Content-Length:");
>> client.println(body.length());
>>
>> So thank you for help me
>>
>>
>>
>> Il giorno domenica 6 ottobre 2013 05:16:40 UTC+2, Vinny P ha scritto:
>>>
>>> On Sat, Oct 5, 2013 at 2:37 AM, giuseppe giorgio <[email protected]>
>>>  wrote:
>>>
>>>> I've paste in previous message the arduino code take a look.
>>>>
>>>
>>>
>>> I did look at the code. I don't see anything particularly wrong with it, 
>>> but I haven't tested it on an Arduino myself.
>>>
>>>
>>> On Sat, Oct 5, 2013 at 2:37 AM, giuseppe giorgio <[email protected]>
>>>  wrote:
>>>>
>>>> What i think is that code it's unable to connect to webservice for some 
>>>> dns problem
>>>>
>>>
>>>
>>> Try using a HTTP client library and use SOAP over that. This library 
>>> works, despite the fact that it hasn't been updated recently: 
>>> https://github.com/amcewen/HttpClient
>>>  
>>>
>>> On Sat, Oct 5, 2013 at 2:37 AM, giuseppe giorgio <[email protected]>
>>>  wrote:
>>>
>>>> in fact also if i try to ping webservice address ( 
>>>> arduino-data-server.appspot.com ) the ip showed it's referred to 
>>>> anothe address ( appspot.l.google.com )
>>>>
>>>>
>>>
>>> That's normal, the same configuration exists for other appspot 
>>> applications as well. 
>>>  
>>>  
>>> -----------------
>>> -Vinny P
>>> Technology & Media Advisor
>>> Chicago, IL
>>>
>>> App Engine Code Samples: http://www.learntogoogleit.com
>>>   
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to