title: How to perform POST requests to a REST webservice?
body: <p>I have a RESTful webservice, in which I have written a method which receives <code>POST</code> requests.</p>
  
  <p>I am trying to access that method via the URL <code>http://localhost:8091/prjctname/post</code>. </p>
  
  <p>But its throwing the following error:</p>
  
  <blockquote>
    <p><em>HTTP Status 405 - Request method 'GET' not supported</em><br>
    <em>type:</em> Status report<br>
    <em>message:</em> Request method 'GET' not supported<br>
    <em>description:</em> The specified HTTP method is not allowed for the requested resource  </p>
  </blockquote>
  
  <p>Below is the code snippet.</p>
  
  <pre class="lang-java prettyprint-override"><code>@RequestMapping(value = "/post", method = RequestMethod.POST)
  @Produces("application/json")
  @ResponseBody 
  public String createUser(@RequestBody PCDBean bean, HttpServletRequest request) {
  
      String username = null;
      String password = null;
      System.out.println("inside post method");
  
      String result = service.getCustomer(username, password);
      if(result != null) {
          return username + password;
      } else {
          return "failure";
      }
  }
  </code></pre>