title: java webservice jax-ws when is @webmethod required
body: <p>I am trying to understand <code>JAX-WS</code> and am having a difficult time to understand the purpose of <code>@WebMethod</code> Annotation.</p>
  
  <p>Here is sample code:</p>
  
  <pre><code>@WebService
  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
  public  class TestServiceImpl  {
  
    public String greet1(String msg) {
      return "greet1";
    }
  
    @WebMethod
    public String greet3(String msg) {
      return "greet3";
    }
  
    public String greet5(String msg) {
      return "greet5";
    }
  </code></pre>
  
  <p>}</p>
  
  <p>when I am looking at the <code>WSDL</code> I can see all the 3 methods <code>'greet1'</code> and <code>'greet3'</code> do not have <code>@WebMethod</code> annotation . 
       Only '<code>greet2'</code> has the annotation.</p>
  
  <p>Here is the <code>WSDL</code>:</p>
  
  <pre><code>&lt;binding name="TestServiceImplPortBinding" type="tns:TestServiceImpl"&gt;   
  &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http"  
   style="document"/&gt;
  &lt;operation name="greet5"&gt;&lt;/operation&gt;
  &lt;operation name="greet3"&gt;&lt;/operation&gt;
  &lt;operation name="greet1"&gt;&lt;/operation&gt;
  &lt;/binding&gt;
  </code></pre>
  
  <p>So not sure what is the use of WebMethod annotation ?</p>