Repository navigation
Using WSS4JInInterceptor from quarkus-cxf-rt-ws-security library allways return HTTP 500 error #945
leoparejaur
started this conversation in
General
Replies: 1 comment
|
Hi @leoparejaur You may have some luck with an interceptor like the below. Please note, this is completely untested - if you need further help, please attach a small reproducer demonstrating the issue. public class SoapFaultOutInterceptor extends AbstractPhaseInterceptor<Message> {
public SoapFaultOutInterceptor() {
super(Phase.PREPARE_SEND);
this.getBefore().add(Soap11FaultOutInterceptor.class.getName());
// If you are using SOAP version 1.2
//this.getBefore().add(Soap12FaultOutInterceptor.class.getName());
}
@Override
public void handleMessage(final Message message) {
// Original SoapFault
final Fault f = (Fault) message.getContent(Exception.class);
// Only Customize WSSecurityException
if (f.getCause() instanceof WSSecurityException) {
System.out.println("Original SoapFault:");
System.out.println("\tClass: " + f.getCause().getClass());
System.out.println("\tFaultCode :" + f.getFaultCode());
System.out.println("\tCause :" + f.getCause().getMessage());
final Throwable myCustomError = new Throwable("This is a custom error message");
final SoapFault myCustomFault = new SoapFault("Custom Error", myCustomError, f.getFaultCode());
message.setContent(Exception.class, myCustomFault);
}
}
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
When Using WSS4JInInterceptor from quarkus-cxf-rt-ws-security library avery security error (worng user, worng password, wong security header) allways return HTTP 500 error, is there a way to change the HTTP error code to 401 or 403?
All reactions