@Override public void addSoapFault(SoapBody soapBody) { soapBody.addClientOrSenderFault(faultStringOrReason, locale); } };
@Override public void addSoapFault(SoapBody soapBody) { soapBody.addClientOrSenderFault(faultStringOrReason, locale); } };
@Override public void addSoapFault(SoapBody soapBody) { soapBody.addClientOrSenderFault(faultStringOrReason, locale); } };
/** * Handles an invalid SOAP message. Default implementation logs the given exception, delegates to the set {@link * #setExceptionResolver(EndpointExceptionResolver) exceptionResolver} if any, or creates a SOAP 1.1 Client or SOAP * 1.2 Sender Fault with the exception message as fault string, and returns {@code false}. * * @param ex the validation exception * @param messageContext the message context * @return {@code true} to continue processing the message, {@code false} (the default) otherwise */ protected boolean handleValidationException(WsSecurityValidationException ex, MessageContext messageContext) { if (logger.isWarnEnabled()) { logger.warn("Could not validate request: " + ex.getMessage()); } if (exceptionResolver != null) { exceptionResolver.resolveException(messageContext, null, ex); } else { if (logger.isDebugEnabled()) { logger.debug("No exception resolver present, creating basic soap fault"); } SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody(); response.addClientOrSenderFault(ex.getMessage(), Locale.ENGLISH); } return false; }
/** * Handles an invalid SOAP message. Default implementation logs the given exception, delegates to the set {@link * #setExceptionResolver(EndpointExceptionResolver) exceptionResolver} if any, or creates a SOAP 1.1 Client or SOAP * 1.2 Sender Fault with the exception message as fault string, and returns {@code false}. * * @param ex the validation exception * @param messageContext the message context * @return {@code true} to continue processing the message, {@code false} (the default) otherwise */ protected boolean handleValidationException(WsSecurityValidationException ex, MessageContext messageContext) { if (logger.isWarnEnabled()) { logger.warn("Could not validate request: " + ex.getMessage()); } if (exceptionResolver != null) { exceptionResolver.resolveException(messageContext, null, ex); } else { if (logger.isDebugEnabled()) { logger.debug("No exception resolver present, creating basic soap fault"); } SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody(); response.addClientOrSenderFault(ex.getMessage(), Locale.ENGLISH); } return false; }
/** * Handles an invalid SOAP message. Default implementation logs the given exception, delegates to the set {@link * #setExceptionResolver(EndpointExceptionResolver) exceptionResolver} if any, or creates a SOAP 1.1 Client or SOAP * 1.2 Sender Fault with the exception message as fault string, and returns {@code false}. * * @param ex the validation exception * @param messageContext the message context * @return {@code true} to continue processing the message, {@code false} (the default) otherwise */ protected boolean handleValidationException(WsSecurityValidationException ex, MessageContext messageContext) { if (logger.isWarnEnabled()) { logger.warn("Could not validate request: " + ex.getMessage()); } if (exceptionResolver != null) { exceptionResolver.resolveException(messageContext, null, ex); } else { if (logger.isDebugEnabled()) { logger.debug("No exception resolver present, creating basic soap fault"); } SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody(); response.addClientOrSenderFault(ex.getMessage(), Locale.ENGLISH); } return false; }
fault = soapBody.addClientOrSenderFault(faultStringOrReason, definition.getLocale());
/** * Handles a fault exception.Default implementation logs the given exception, and creates a SOAP Fault with the * properties of the given exception, and returns {@code false}. * * @param ex the validation exception * @param messageContext the message context * @return {@code true} to continue processing the message, {@code false} (the default) otherwise */ protected boolean handleFaultException(WsSecurityFaultException ex, MessageContext messageContext) { if (logger.isWarnEnabled()) { logger.warn("Could not handle request: " + ex.getMessage()); } SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody(); SoapFault fault; if (response instanceof Soap11Body) { fault = ((Soap11Body) response).addFault(ex.getFaultCode(), ex.getFaultString(), Locale.ENGLISH); } else { fault = response.addClientOrSenderFault(ex.getFaultString(), Locale.ENGLISH); } fault.setFaultActorOrRole(ex.getFaultActor()); return false; }
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
/** * Handles a fault exception.Default implementation logs the given exception, and creates a SOAP Fault with the * properties of the given exception, and returns {@code false}. * * @param ex the validation exception * @param messageContext the message context * @return {@code true} to continue processing the message, {@code false} (the default) otherwise */ protected boolean handleFaultException(WsSecurityFaultException ex, MessageContext messageContext) { if (logger.isWarnEnabled()) { logger.warn("Could not handle request: " + ex.getMessage()); } SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody(); SoapFault fault; if (response instanceof Soap11Body) { fault = ((Soap11Body) response).addFault(ex.getFaultCode(), ex.getFaultString(), Locale.ENGLISH); } else { fault = response.addClientOrSenderFault(ex.getFaultString(), Locale.ENGLISH); } fault.setFaultActorOrRole(ex.getFaultActor()); return false; }
/** * Handles a fault exception.Default implementation logs the given exception, and creates a SOAP Fault with the * properties of the given exception, and returns {@code false}. * * @param ex the validation exception * @param messageContext the message context * @return {@code true} to continue processing the message, {@code false} (the default) otherwise */ protected boolean handleFaultException(WsSecurityFaultException ex, MessageContext messageContext) { if (logger.isWarnEnabled()) { logger.warn("Could not handle request: " + ex.getMessage()); } SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody(); SoapFault fault; if (response instanceof Soap11Body) { fault = ((Soap11Body) response).addFault(ex.getFaultCode(), ex.getFaultString(), Locale.ENGLISH); } else { fault = response.addClientOrSenderFault(ex.getFaultString(), Locale.ENGLISH); } fault.setFaultActorOrRole(ex.getFaultActor()); return false; }
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
} else if (SoapFaultDefinition.CLIENT.equals(replyMessage.getFaultCodeQName()) || SoapFaultDefinition.SENDER.equals(replyMessage.getFaultCodeQName())) { soapFault = soapBody.addClientOrSenderFault(replyMessage.getFaultString(), replyMessage.getLocale()); } else if (soapBody instanceof Soap11Body) {
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail();
/** * Template method that is called when the request SOAP headers contains validation errors. * Default implementation logs all errors, and returns <code>false</code>, i.e. do not process the request. * * @param messageContext the message context * @param errors the validation errors * @return <code>true</code> to continue processing the request, <code>false</code> (the default) otherwise * @throws TransformerException if error occurs during the transformation process */ protected boolean handleHeaderValidationErrors(MessageContext messageContext, ValidationException[] errors) throws TransformerException { for (ValidationException error : errors) { logger.warn("XML validation error on request: " + error.getMessage()); } if (messageContext.getResponse() instanceof SoapMessage) { SoapMessage response = (SoapMessage) messageContext.getResponse(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addClientOrSenderFault(faultHeaderStringOrReason, getFaultStringOrReasonLocale()); if (getAddValidationErrorDetail()) { SoapFaultDetail detail = fault.addFaultDetail(); for (ValidationException error : errors) { SoapFaultDetailElement detailElement = detail.addFaultDetailElement(getDetailElementName()); detailElement.addText(error.getMessage()); } } } return false; }