title: Spring MVC- REST POST - Bad Request 400
body: <p>I am trying to post a request to my service, but it's not working. I am getting <code>400 Bad Request</code>. I have GET requests that are working perfectly in the same controller.</p>
  
  <p>Here is the method:</p>
  
  <pre><code>@RequestMapping(value = "/assign", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
      @ResponseBody
      public Form5398Obj arriveTrip(@PathVariable String siteId,
                  @RequestBody ErrorMsg anError) throws Exception {
  
          System.out.println(anError.toString());
  
      }
  </code></pre>
  
  <p>The ErrorMessage java class is as follows:</p>
  
  <pre><code>public class ErrorMsg {
  
      private String code;
      private String msg;
      private String request;
  
      public ErrorMsg(String code, String msg, String request)
      {
          this.code = code;
          this.msg = msg;
          this.request = request;
      }
      public String getCode() {
          return code;
      }
      public void setCode(String code) {
          this.code = code;
      }
      public String getMsg() {
          return msg;
      }
      public void setMsg(String msg) {
          this.msg = msg;
      }
      public String getRequest() {
          return request;
      }
      public void setRequest(String request) {
          this.request = request;
      }
  
  }
  </code></pre>
  
  <p>I did not configure anything else. What else do I need to do to get it to work? I am using JavaConfig, do I need to add any bean declarations?</p>
  
  <p>I am sending:
  with Content-Type: application/json</p>
  
  <pre><code>{
                  "code" : "101",
                  "msg" : "Hello Test",
                  "request" : "1"
  }
  </code></pre>