Defining Web service handlers (J2EE 1.x)

For J2EE 1.3 and 1.4 modules that include Web service references, you can use the deployment descriptor editor to define and configure Web service handlers for each Web service reference. Handlers allow you to process SOAP message header traffic for the remote call to the Web service. The SOAP header is defined by the SOAP specification. Handlers are defined by JAX-RPC and the Web Services for J2EE specification. You can use the deployment descriptor editor to to define Web service handler for a Web service reference:

Before you begin

In order to define Web service handlers, you must first define a Web service reference.

About this task

When you define a handler for a Web service reference, the handler element is added to the related service reference (the service-ref element). For J2EE 1.3, the service-ref element is in the webservicesclient.xml file. For J2EE 1.4, it is in the deployment descriptor.

Procedure

  1. In the Enterprise Explorer of the Java™ EE perspective, expand the project tree and select the deployment descriptor for your project where you want to define a Web service handler. You can define Web service handlers for Web service references in EJB projects, application client projects, and web projects.
  2. Right-click the deployment descriptor and select Open With > Deployment Descriptor Editor from the pop-up menu. The appropriate deployment descriptor for your project type opens. For example, an EJB module opens in the EJB deployment descriptor editor.
  3. Click the WS Handler tab to go to the Handlers page of the deployment descriptor editor.
  4. In the Service references drop-down list, select the Web service reference that you want to define the handler for.
  5. Click Add to open the New Handler dialog box and define the handler:
    1. In the Display name field, type a value for the display-name element in the deployment descriptor.
    2. In the Description field, type a value for the description element for the handler.
    3. In the Handler name field, type a value for the handler-name element.
    4. In the Handler class field, enter the fully qualified name of the Java class for the handler. This value is used in the handler-class element.
  6. Click Finish. The handler is added to the list of handlers defined for the selected reference. If you select the handler, you can see and modify the properties.
  7. Optional: In the Icons section, you can specify small and large GIF or JPEG images to help identify the Web service handler at run time. The images must first be imported into the project.
  8. Optional: In the Initial parameters section, click the Add button to define a name and value for an initialization parameter for the selected handler.
  9. Optional: In the SOAP headers section, click the Add button to define the namespace URL and local part for a new SOAP header for the handler.

Feedback