What are JAX-WS Interceptors (also known as handle

2019-01-26 13:33发布

问题:

What are JAX WS Interceptors? Where do I find info regarding the same!

回答1:

JAX-WS interceptors (also called handlers) are used to weave in aspects of the request in a transparent way. Example of this are logging or requests/responses, adding security headers to the message, encryption, compression, etc. A single interceptor can manipulate either the logical payload (content) of the message or the protocol of the message, but cannot do both.

See here for the introductory documentation on them.



回答2:

Handlers are basically similar to filters, but for inboud and output processing of SOAP messages. Here is a quick tutorial I found.



回答3:

in addition to a Handler in JAX-WS, the RI also provides the Tube concept. It is pretty close to the Filter concept in a Servlet API, as such you can access and manipulate entire in/out packet for a service and a client alike.

I find it more handy for general purposes, like logging of messages and prevalidation of soap headers, etc just because I dont have to attach a @HandlerChain on every web-service. See link.

Tube based message logging