Adding Web service annotation tags

Annotation-based programming tags are used within your EJB Projects or Web projects as providers of metadata that is then used to generate other application artifacts as required. Annotation tags are added to the comments section at the top of a Java™ file.

Adding annotation tags to a Java bean

  1. Adding support for annotations can be done using the New Dynamic Web Project wizard. On the New Dynamic Web Project page, click Show Advanced. Select the Add support for annotated Java classes check box.

  2. Create or import a Java package and its required classes into the project.
  3. Add any required annotation tags to the comment section at the top of the Java file. When creating a Web service from a Java bean, the only required annotation tag is @WebSphere.WebService.

Example: The following Java code will create a Web service that uses document literal encoding and style, and contains an operation called "Bye."

Adding annotation tags to an EJB bean

  1. Adding annotation tag support can be done using the New EJB Project wizard. On the New EJB Project page, click Show Advanced. Select the Add support for annotated Java classes check box.

  2. Create or import a Java package and its required classes into the project.
  3. Add any required annotation tags to the comment section at the top of the Java file. When creating an EJBWeb service from a Java bean, the required annotation tags are@WebSphere.WebService and @ejb.session.

Example: The following Java code will create a stateless session EJB Web service that uses document literal encoding and style, and contains an operation called "sayhello."

Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.