title: HttpWebRequest : empty body
body: <p>I have some Java REST WS which are working well.
  Code : </p>
  
  <pre><code>@RequestMapping(value = "/filter", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
  @ResponseBody
  public String filterByAttribute(@RequestBody final Constraint filterConstraint) {
  RestConfigurationService.LOGGER.info("Calling rest service filterByAttribute with params [ attributeName: " + filterConstraint.getAttribute()
          + ", attributeValue: " + filterConstraint.getValue() + "]");
  //...Some stuff....
      return "hello";
  }
  </code></pre>
  
  <p>Constraint Pojo :</p>
  
  <pre><code>/*    */ @JsonIgnoreProperties(ignoreUnknown=true)
  /*    */ public class Constraint
  /*    */ {
  /*    */   @JsonProperty("attribute")
  /*    */   private String attribute;
  /*    */   @JsonProperty("value")
  /*    */   private String value;
  ...
  </code></pre>
  
  <p>I try to call that WS in my front C# webapp with this code :</p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(completeUrl);
          request.ContentType = "application/json; charset=utf-8";
          request.Method = "POST";
  
          using (var streamWriter = new StreamWriter(request.GetRequestStream()))
          {
              string json = "{ \"attribute\": \"Applications\", \"value\": \"Pompes et appareils immergés\" }";
  
              streamWriter.Write(json);
              streamWriter.Flush();
          }
  
          string token = (string)Session["token"];
          request.Headers.Add("Authorization", "Bearer " + token);
  
  
          try
          {
              HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  ...
  </code></pre>
  
  <p>(I use OAuth, this part is OK.)
  On the C# side I get an error 400 bad request.
  On Java WS Side : </p>
  
  <p>06-01-2016 09:27:46,141 [ramework.web.method.support.InvocableHandlerMethod:168 :DEBUG] http-bio-8080-exec-6 -  - <strong>Error resolving argument [1] [type=java.lang.String]</strong>
  HandlerMethod details: 
  Controller [com.blabla.volta.rest.service.RestConfigurationService]
  Method [public org.springframework.http.ResponseEntity com.blabla.volta.rest.service.RestConfigurationService.filterByAttribute(java.lang.String,java.lang.String)]</p>
  
  <p>org.springframework.http.converter.HttpMessageNotReadableException: <strong>Required request body is missing:</strong> public org.springframework.http.ResponseEntity com.blabla.volta.rest.service.RestConfigurationService.filterByAttribute(java.lang.String,java.lang.String)
      at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:151)</p>
  
  <p>What do i miss?</p>
  
  <p><strong>Edit</strong> : I've tried with </p>
  
  <pre><code>string json = "pwet";
  </code></pre>
  
  <p>and on java side i got </p>
  
  <p>org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unexpected character ('p' (code 112)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')</p>
  
  <p>So i understand that my json (the first one) is not well formated or something, but java service actually see the msg.</p>