title: Spring boot Java post request
body: <p>I am trying to do a simple post request from React (client side) to Java server side. Here is my controller below. </p>
  
  <pre><code>package com.va.med.dashboard.controllers;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.HttpStatus;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.*;
  
  import com.va.med.dashboard.services.VistaServiceImpl;
  import gov.va.med.exception.FoundationsException;
  
  @RestController
  @RequestMapping("/dashboard")
  public class DashboardController  {
  
     @Autowired
     private VistaServiceImpl vistaService;
  
     @RequestMapping("/main")
     String home() {
            return "main route";
     }
  
     @RequestMapping("/rpc")
     String test() throws FoundationsException {
            vistaService.myAuth();
            return "this is rpc route";
     }
  
     @RequestMapping(method = RequestMethod.POST, produces = 
  "application/json", value = "/vista")
     @ResponseStatus(value = HttpStatus.ACCEPTED)
     public String getVistaConnection(@RequestBody String ipString, @RequestBody String portString, @RequestBody String accessPin,
     @RequestBody String verifyPin) {
  
         System.out.println(ipString);
         System.out.println(portString);
         System.out.println(accessPin);
         System.out.println(verifyPin);
  
         vistaService.connect(ipString, portString, accessPin, verifyPin); // TO-DO populate with serialized vars
         if (vistaService.connected) {
                return "Connected";
         } else {
                return "Not Connected";
         }
     }
  }
  </code></pre>
  
  <p>Below is my react axios post request</p>
  
  <pre><code> axios.post('/dashboard/vista', {
    ipString: this.state.ipString,
    portString: this.state.portString,
    accessPin: this.state.accessPin,
    verifyPin: this.state.verifyPin
  })
  .then(function (response){
    console.log(response);
  })
  .catch(function (error){
    console.log(error);
  });    
  </code></pre>
  
  <p>This is also the error that I am getting. </p>
  
  <pre><code>Failed to read HTTP message:     
  org.springframework.http.converter.HttpMessageNotReadableException: 
  Required request body is missing:
  </code></pre>
  
  <p>Can anyone please shed some light on this error message? I'm coming from a pure JavaScript background so a lot of things I just don't know for Java because it is automatically implemented inside of JavaScrips language. </p>
  
  <p>Thanks again in advance!</p>