# @jws:handler Annotation

Specifies SOAP message handlers for a web service.

To learn about SOAP message handlers and how to configure them in WebLogic Workshop web services, see Specifying SOAP Handlers for a Web Service.

## Syntax

@jws:handler

[operation="<handler-spec>"]

[callback="<handler-spec>"]

[file="<handler-config-file-name>"]

## Attributes

operation

Optional. Specifies the handler(s) that will process request and response SOAP messages associated with operations (methods) of a web service. May be a space-separated list of handler class names or the name of a <handler-chain> defined in a handler configuration file specified by the file attribute. Each handler class must implement the javax.xml.rpc.handler.Handler interface.

callback

Optional. Specifies the handler(s) that will process request and response SOAP messages associated with callbacks of a web service. May be a space-separated list of handler class names or the name of a <handler-chain> defined in a handler configuration file specified by the file attribute. Each handler class must implement the javax.xml.rpc.handler.Handler interface.

Note that when testing callback handlers, you must invoke the handler via a service control. If you invoke the service from the test interface, the callback handlers are never invoked. The callback handlers have to be tested from a client that implements the callback interface, which the test interface cannot.

file

Optional. Specifies a handler configuration file. A handler configuration file is an XML file that defines handlers, handler chains and handler initialization data. See Example Handler Configuration File, below.

## Remarks

The @jws:handler annotation is used to associate SOAP message handlers with a web service. Each SOAP handler is a class that implements the javax.xml.rpc.handler.Handler interface.

The following rules apply to this annotation's use:

- The @jws:handler annotation may only be applied to the main class in a web service JWS file.

- Only one @jws:handler annotation is allowed per JWS file.

## Example Handler Configuration File

A handler configuration file is an XML file that conforms to the WebLogic Workshop handler configuration schema. The example below illustrates a sample handler configuration file:

      <?xml version="1.0" encoding="UTF-8"?>
      <hc:wlw-handler-config xmlns:hc="http://www.bea.com/2003/03/wlw/handler/config/">
          <hc:handler-chain name="LoggingHandler">
              <hc:handler handler-name="Logger" handler-class="handler.ConsoleLoggingHandler"/>
    		      <hc:init-param>
                      <hc:description>First Param</hc:description>
                      <hc:param-name>param1</hc:param-name>
                      <hc:param-value>value1</hc:param-value>
                  </hc:init-param>
    		      <hc:init-param>
                      <hc:description>Second Param</hc:description>
                      <hc:param-name>param2</hc:param-name>
                      <hc:param-value>value2</hc:param-value>
                  </hc:init-param>
              <hc:handler handler-name="Auditor" handler-class="handler.AuditHandler"/>
          </hc:handler-chain>
      </hc:wlw-handler-config>

The handler-class attribute of each <handler> element must refer to a handler class that implements the javax.xml.rpc.handler.Handler interface.

Any <init-param> elements that are present for a given <handler> element will be passed to the handler's init() method when the handler is initialized.

Related Topics

Specifying SOAP Handlers for a Web Service

@jc:handler Annotation