HTTp to REST without response

Hi everyone,

I'm sending a file to a Rest WebService, in this way:

 HttpWebRequest := HttpWebRequest.Create('http://eshop.xxxxx-eu.com/ws/api/rest');
 HttpWebRequest.Method := 'POST';
 HttpWebRequest.ContentType('application/x-www-form-urlencoded');
 postString := STRSUBSTNO('json=%1',pJson);
 StreamWriter := StreamWriter.StreamWriter(HttpWebRequest.GetRequestStream);
  StreamWriter.Write(postString);
  StreamWriter.Close;
  StreamWriter.Dispose;
  HttpWebRequest.GetResponse;

But I'mn getting an error in the WebResposne, becasue the server is not responding anything. How can i "run" the request without expecting any response?

Thank you very much

Parents
  • And what does the error message look like?

    In a situation like this, when a client does not receive any response from the server, I would look for a communication error in the first place. Either the server does not receive the request, or the client does not get the response. HttpWebRequest doesn't support such "deaf" requests, because it's one of the basic requirements of the HTTP protocol that the sever must send a response. It may not contain a body, but at least the header with a status code must be sent back to the client.

Reply Children
Related
Recommended