title: Post using spring resttemplate
body: <p>Rest server:</p>
  
  <pre><code>@RequestMapping(value = "/rest/{code}", method=RequestMethod.POST)
  public @ResponseBody String sendMessage(@PathVariable String code) {
      boolean h = true;
      try {
          String trackNum = code.substring(0, 34).trim();
          String eventTime = code.substring(35, 60).trim();
          String userName = code.substring(61, 70).trim();
          String eventDispoCode = code.substring(71, 73).trim();
          String loc = code.substring(73, 82).trim();
          String eventTxt = code.substring(83);
  
          History histInfo = new History();
          histInfo.setDeviceName(userName+"_WEB");
          histInfo.setLogInId(userName);
          histInfo.setAppVersion("1");
          histInfo.setLocCode(loc);
          histInfo.setUserName(userName);
  
      h = interceptService.processPackageIntercept(histInfo,loc, trackNum, new LocalDateTime(eventTime));
  
      } catch (Exception e) {
          e.printStackTrace();
      }
      if(h){
          return "true";
      }else{
          return "false";
      }
  }
  </code></pre>
  
  <p>In Server <code>h = interceptService.processPackageIntercept(histInfo,loc, trackNum, new LocalDateTime(eventTime));</code> this service have methods to save details into DB. </p>
  
  <p>Rest client:</p>
  
  <pre><code>    String url =  "http://localhost:8090/packageintercept/rest/";
      String st = (String) restTemplate.postForObject(url, b.toString(), String.class);
  </code></pre>
  
  <p>When I used <code>getForObject()</code> I can hit DB to retrieve the data but cannot save it in there. When I changed to <code>postForObject()</code> I get <code>HttpClientErrorException. 403 Forbidden error</code></p>
  
  <p>Any suggestions! What am I doing wrong here?</p>