Home

 

Creating a Web service using annotations

The Java API for XML-Based Web Services (JAX-WS) programming standard relies on the use of annotations to specify metadata that is associated with Web service implementations. The standard also relies on annotations to simplify the development of Web services. The JAX-WS standard supports the use of annotations that are based on several Java Specification Requests (JSRs):

A Metadata Facility for the Java Programming Language (JSR 175)

Web Services Metadata for the Java Platform (JSR 181)

Java API for XML-Based Web Services (JAX-WS) 2.1 (JSR 224)

Common Annotations for the Java Platform (JSR 250)

Using annotations from the JSR 181 standard, we can annotate a service implementation class or a service interface. Then we can generate a Web service with a wizard or by publishing the application to a server. Using annotations within both Java source code and Java classes simplifies Web service development. Using annotations in this way defines additional information that is typically obtained from deployment descriptor files, Web Services Description Language (WSDL) files, or mapping metadata from XML and WSDL into source artifacts.

In this section, we create a bottom-up Web service from a JavaBean using annotations. The Web services are generated by publishing the application to a server. No wizard is required in this example.

ibm.com/redbooks