## Create a JAX-WS Handler

JAX-WS handlers are message interceptors that may be used to carry out additional processing on inbound and outbound messages.

Protocol handlers are specific to a protocol (e.g. SOAP) and they may access or change protocol specific aspects of a message while logical handlers are protocol agnostic and may only act on the message payload.

### Prerequisites:

Complete one of the following tasks to generate a Web service:

- Generate an SEI and a skeleton implementation bean from a WSDL document using Apache CXF
- Generate a JAX-WS Web Service Client from a WSDL document using Apache CXF

To create a JAX-WS Handler:

1. Select Window > Open Perspective > Java EE from the top level menu to switch to the Java EE perspective.
2. Open the JAX-WS Handler wizard by selecting File > New > Other... > Web Services > JAX-WS > JAX-WS Handler from the top level menu.
3. JAX-WS Handler page:

   1. Browse to select the Source folder.
   2. Browse to select an existing Package or enter a new package name.
   3. Enter a Name for the JAX-WS Handler.
   4. Select the Handler type:
      - Logical Handler
      - Protocol Handler (SOAP)

   In the Configuration section:

   5. Select the Add this handler to a handler chain checkbox.

   6. Select Create a new handler chain file and browse to select a location in the project where the handler chain file will be generated.

      Note: To add this JAX-WS handler to an existing handler-chain in the project select Add this handler to an existing handler chain file and browse to select the file location.

      Selecting Next will then display a wizard page which will allow you to select the position of the new JAX-WS handler in the handler chain file.

   7. Select Associate this handler chain with a Web service and browse to select the Web service implementation or service endpoint interface that was created in the prerequisites.

      Click Finish.

      The wizard will generate a skeleton JAX-WS Handler, handler-chain file and annotate the Web service with the `@javax.jws.HandlerChain` annotation.

Generate an SEI and a skeleton implementation bean from a WSDL document using Apache CXF
Generate a JAX-WS Web Service Client from a WSDL document using Apache CXF