# Java TM API for XML Web Services
(JAX-WS)
Tools

Specification Version: 2.2
Implementation Version: 2.2.5

- Overview
- Wsimport
- Wsimport Ant Task
- Wsgen
- Wsgen Ant Task
- Apt

## Contents

1. apt
2. wsimport
3. wsgen
4. How do I pick a tool?

## `apt`

The `apt` tool provides a facility for programmatically processing the annotations added to Java by JSR 175, Metadata Facility for the Java TM Programming Language. In brief, JSR 175 allows programmers to declare new kinds of structured modifiers that can be associated with program elements, fields, methods, classes, etc.

The `apt` tool generates the portable artifacts used in JAX-WS services.

For more information on this tool please see: apt tool.

## wsimport

The `wsimport` tool generates JAX-WS portable artifacts used in JAX-WS clients and services. The tool reads a WSDL and generates all the required artifacts for web service development, deployment, and invocation.

For more information on this tool please see: wsimport tool.

## wsgen

The `wsgen` tool reads a `` `` `` `` `` ``service endpoint implementation class and generates all of the portable artifacts for a JAX-WS web service..

For more information on this tool please see: wsgen tool.

### Running on JDK6

- Copy JAXWS_HOME/lib/jaxws-api.jar to JDK6_HOME/jre/lib/endorsed directory
- Copy JAXWS_HOME/lib/jaxb-api.jar to JDK6_HOME/jre/lib/endorsed directory

For details see Endorsed Directory Mechanism. Above, JAXWS_HOME points to the root directory of the extracted JAX-WS RI bundle. JDK6_HOME points to JDK 6 installation directory.

## How do I pick a tool?

The following lists the process to create a web service starting from Java sources, classes, and a WSDL file (server side):

1. Starting from Java sources:
   1. Use `apt` to generate the artifacts required by the JAX-WS specification.
   2. Package the `web.xml`, `sun-jaxws.xml`, service endpoint interface and implementation class, value types, and generated classes, if any, into a WAR file,
   3. Deploy the WAR to a web container.
2. Starting from Java classes:
   1. Use `wsgen` to generate portable artifacts.
   2. Package the `web.xml`, `sun-jaxws.xml`, service endpoint interface and implementation class, value types, and generated classes, if any, into a WAR file,
   3. Deploy the WAR to a web container.
3. Starting from a WSDL file:
   1. Use `wsimport` to generate portable artifacts.
   2. Implement the service endpoint.
   3. Package the WSDL file, schema documents, `web.xml`, `sun-jaxws.xml`, service endpoint interface and implementation class, value types, and generated classes, if any, into a WAR file.
   4. Deploy the WAR to a web container.

The following lists the process to invoke a web service (client side):

1. Starting from deployed web service's WSDL
   1. Use `wsimport` to generate the client-side artifacts.
   2. Implement the client to invoke the web service.