title: Consume a java REST service with .net client
body: <p>I'm facing some problem with .net and REST by java. The scenario is: a handheld with .net compact framework 3.5 trying to consume a RESTeasy service. This is my (relevant) client code:</p>
  
  <pre><code>string url = textBox1.Text;
  url = "http://192.168.1.77:8080/demo-rest/myresource/message";
  try
  {
      string json = "{id: 5, message: hello}";
      HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
      req.ContentType = "application/json;charset=utf-8";
      req.KeepAlive = false;
      req.ProtocolVersion = HttpVersion.Version11;
      req.Method = "POST";
      byte[] postBytes = Encoding.UTF8.GetBytes(json);
      req.ContentLength = postBytes.Length;
      StreamWriter postwriter = new StreamWriter(req.GetRequestStream());
      postwriter.Write(postBytes);
      postwriter.Close();
      handleResponse((HttpWebResponse)req.GetResponse());
  }
  catch (Exception ex)
  {
      textBox3.Text = url + "\n" + ex.Message;
  }
  </code></pre>
  
  <p>Pretty simple, but, I always got the same error: HTTP 400 Bad Request. Here is the (relevant) stack trace:</p>
  
  <pre><code>Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('S' (code 83)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
  </code></pre>
  
  <p>what's wrong in my client?</p>