Main Site Documentation

Strange HttpPostRequest


#1

Folks,

Thank to everyone on this site, I am nearly complete with a project I am doing for school. The project is modeled after Michael Dodaro’s project that sends data from a sensor to a web service. I have my web service running and have confirmed it is working with Wiztools REST Client. I can POST to this service from any computer on my home network EXCEPT my FEZ Spider & WIFI module.

Everything on the board checks out, I can get an IP address, ping it from other devices on my network. I can even do a WebClient.GetFromWeb and see data from a website. The only thing not working is the POST…I get an HTTP status code 400. Here is the code:


public void SendPulseOxData(string name, string pulse, string oxg)
        {POSTContent emptyPost = new POSTContent();
 var req = HttpHelper.CreateHttpPostRequest("http://192.168.1.8/PulseOxData/reading/" +name + "/" + pulse + "/" + oxg, emptyPost, null);}

If I hardcode the data into the string, it works! For example:

   
POSTContent emptyPost = new POSTContent();
var req = HttpHelper.CreateHttpPostRequest("http://192.168.1.8/PulseOxData/reading/AccountTemp/78/97", emptyPost, null);

Any ideas?


#2

create a string object that contains your URI, assembled as you do, then call the POST request using that string. Set a breakpoint on the string. I suspect something is not right in the object.


#3

Thanks Brett…that helped.

When I continued to enter code on the next line, there was a space I could not see. I wrote everything that was going to the POST request to a string and displayed in using debug. Found the space.

Thank you!