title: Spring RestTemplate POST Query with Headers and Body
body: <p>I need to consume the given API definition, But I am not able to find a function call that takes both headers and request body at <a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html" rel="noreferrer">documentation</a>. Please suggest which function of RestTemplate to use here. </p>
  
  <pre><code>@RequestMapping(value = "/createObject", method = RequestMethod.POST,
          consumes = MediaType.APPLICATION_JSON_VALUE, 
          produces = MediaType.APPLICATION_JSON_VALUE)
  public ResponseEntity&lt;CreateObjectOutput&gt; createObject(
          @RequestBody CreateObjectInput req) 
  {
      CreateObjectOutput out = new CreateObjectOutput();
      ///// Some Code
      return new ResponseEntity&lt;CreateObjectOutput&gt;(out, HttpStatus.OK);
  }
  </code></pre>