JAX-WS Handlers
As an alternative to the @HandlerChain
annotation,
JAX-WS Handlers can be added
to both your client or server via application.properties
:
application.properties
# A web service endpoint with multiple Handler classes
quarkus.cxf.endpoint."/greeting-service".handlers=org.acme.MySOAPHandler,org.acme.AnotherSOAPHandler
# A web service client with a single Handler
quarkus.cxf.client."greeting-client".handlers=org.acme.MySOAPHandler
Where MySOAPHandler
could look like below:
import jakarta.xml.ws.handler.soap.SOAPHandler;
import jakarta.xml.ws.handler.soap.SOAPMessageContext;
public class MySOAPHandler implements SOAPHandler {
public boolean handleMessage(SOAPMessageContext messageContext) {
SOAPMessage msg = messageContext.getMessage();
return true;
}
// other methods
}
The SOAPHandler classes will be attempted to be loaded via CDI first.
If no CDI beans are available for the given type, then the no parameters constructor will used
to instantiate each class.
|