Creating and editing JAX-WS web service handlers

You can add JAX-WS logical or protocol handlers to intercept inbound and outbound messages to or from web services and their clients. You can select from any currently available JAX-WS web services and clients and start the Handler Creation Wizard. In the wizard, you provide the class name of the handler, the handler name, and an optional display name, and specify the type of handler. When finished, the wizard generates the skeleton handler code and updates the applicable deployment descriptor.

About this task

The Handler Creation Wizard helps you:
  • Add or edit service-side handlers
  • Add or edit client-side handlers

Adding or editing service-side handlers

Procedure

  1. Open the Services view.
  2. From the JAX-WS tree, select your web service. Right-click and select Configure JAX-WS Web Service Handlers.
  3. If handlers are already defined for the service, you can delete or reorder them. You can also add a handler by clicking Add.
    1. Select if you want to create a new handler class or select an existing one.
    2. Enter or browse to the fully qualified class name for the handler.
    3. Enter a name for the handler.
    4. Optional: Enter a display name for the handler.
    5. Select the handler type, logical or protocol.
    6. The output folder for the handler is listed. The default folder is the src folder for the service.

Adding client-side handlers

About this task

Procedure

  1. Open the Services view.
  2. From the JAX-WS tree, select your web service client. Right-click and select Configure JAX-WS ClientHandlers.
  3. If handlers are already defined for the client, you can delete or reorder them. You can also add a handler by clicking Add.
    1. Browse to the fully qualified class name for the handler.
    2. Enter a name for the handler.
    3. Optional: Enter a display name for the handler.
    4. Select the handler type, logical or protocol.
    5. The output folder for the handler is listed. The default folder is the src folder for the client.

Testing web service handlers

Procedure

  1. Modify the generated handler classes (such as by adding println).
  2. Run the web service client sample JSP and test the web services to verify that the handlers intercept the traffic correctly.