1 Reply Latest reply: Dec 11, 2012 8:20 PM by User696-Oracle RSS

    WebMethod

    tron
      Can someone explain the difference between a plain public method versus using the @WebMethod statement before a public method?

      I don't understand why @WebMethod is needed instead of just making publicly accessible things, public.
        • 1. Re: WebMethod
          User696-Oracle
          Any public method is exposed as webservice method with default values. In the absence of @WebMethod, the value of the name attribute of the wsdl:operation element MUST be the name of the Java method.
          When using method-based injection, it is recommended that the method be declared as non-public, otherwise it will be exposed as a web service operation. Alternatively, the method can be marked with the @WebMethod(exclude=true) annotation to ensure it will not be part of the generated portType for the service.

          The javax.jws.WebMethod annotation MAY be used to customize the value of the name attribute of the wsdl:operation element and MUST be used to resolve naming conflicts.

          HTH
          Regards,
          Sunil P