title: Call web service with parameters
body: <p>I have to call a web service.
  The web service has input two parameters and does not return anything in output.</p>
  
  <p>Can you tell me if the code (written below) is correct and complete?
  I inserted it inside the main.</p>
  
  <pre><code>var httpWebRequest = (HttpWebRequest)WebRequest.Create("url");
  httpWebRequest.ContentType = "application/json";
  httpWebRequest.Method = "POST";
  httpWebRequest.Credentials = new NetworkCredential("user", "pwd", "domain");
  
  using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
  {
      string json = "{p1:\'Hello\'";
  
      string tmpjs = ",p2:\'world\'}";                       
      json = json + tmpjs;
  
      streamWriter.Write(json);
      streamWriter.Flush();
      streamWriter.Close();
  }
  
  HttpWebResponse httpResponse = (HttpWebResponse) httpWebRequest.GetResponse();
  </code></pre>