Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a global JAX-WS MessageHandler that intercepts all services in a transparent way?

We have a set of web services implemented in JAX-WS and a SOAPHandler that adds control attributes in the SOAP headers. Today, we need to add the @HandlerChain annotation in every new service we create.

The idea is that new services implementors do not need to know that a @HandlerChain exists.

Is there a way to configure a global Handler that intercepts all services running in my WAR?

like image 494
Joaquim Oliveira Avatar asked Oct 14 '11 12:10

Joaquim Oliveira


People also ask

What is JAX-WS how it is useful for describing SOAP Web services?

JAX-WS is a technology for building web services and clients that communicate using XML. JAX-WS allows developers to write message-oriented as well as RPC-oriented web services. In JAX-WS, a web service operation invocation is represented by an XML-based protocol such as SOAP.

What is JAX-WS handler?

Tags:jax-ws | server | soap | web services. SOAP handler is a SOAP message interceptor, which is able to intercept incoming or outgoing SOAP message and manipulate its values.

What is a web service handler?

The web service handler is a Java client that can invoke any document-literal web service that is WS-I BP 1.1 compliant. The outbound integration message forms the payload (SOAP body) and the handler provides the SOAP headers and envelope. This handler operates independent of the container.


1 Answers

One option that might work is aspectj. With bytecode weaving (or in conjunction with spring if you'd like) you can create a single handler as an aspect and weave into all classes (and WAR files as well) through maven plugin perhaps. I haven't tried this myself I guess the only challenge would be getting a handle on the SOAP header from the aspect.

like image 76
ramsinb Avatar answered Oct 25 '22 05:10

ramsinb