You want to decorate your service request by intercepting it immediately prior to invocation so that you can modify certain protocol-specific parts of your request, such as SOAP headers. You don’t want to bake this code into your message construction, or you aren’t using SAAJ.
SOAPMessageContext> interface to use a
ProtocolHandler. Write a class that
HandlerResolver interface and puts your
handler in a list. Add an instance of your resolver to your service
proxy before you get its port. The handler will be invoked at each
request sent and each response received by the runtime.
There are two types of message handlers defined in JAX-WS:
LogicalHandlers. If you want to operate on the payload of your message
itself or its message context properties, use a logical handler
(discussed in Intercepting the Request to Perform Work on Your Payload). If you
want to operate on some part of the message that is specific to the
binding protocol in use, such as SOAP, then you can use a protocol
handler. One such handler, defined out of the box by JAX-WS, is the
SOAPHandler, which allows you to operate on the
SOAP envelope, such as its headers, attachment, or fault. This recipe
examines that class.
Handlers are similar to EJB 3 interceptors or servlet filters. On the client side, handlers are used to modify or simply access ...