Spring Web Services Framework

org.springframework.ws.soap.server.endpoint.interceptor
Class AbstractFaultCreatingValidatingInterceptor

java.lang.Object
  extended by org.springframework.xml.transform.TransformerObjectSupport
      extended by org.springframework.ws.server.endpoint.interceptor.AbstractValidatingInterceptor
          extended by org.springframework.ws.soap.server.endpoint.interceptor.AbstractFaultCreatingValidatingInterceptor
All Implemented Interfaces:
InitializingBean, EndpointInterceptor
Direct Known Subclasses:
PayloadValidatingInterceptor

public abstract class AbstractFaultCreatingValidatingInterceptor
extends AbstractValidatingInterceptor

Subclass of AbstractValidatingInterceptor that creates a SOAP Fault whenever the request message cannot be validated. The contents of the SOAP Fault can be specified by setting the addValidationErrorDetail, faultStringOrReason, or detailElementName properties. Further customizing can be accomplished by overriding handleRequestValidationErrors.

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
setAddValidationErrorDetail(boolean), setFaultStringOrReason(String), DEFAULT_FAULTSTRING_OR_REASON, setDetailElementName(javax.xml.namespace.QName), DEFAULT_DETAIL_ELEMENT_NAME, AbstractValidatingInterceptor.handleResponseValidationErrors(org.springframework.ws.context.MessageContext,org.xml.sax.SAXParseException[])

Field Summary
static QName DEFAULT_DETAIL_ELEMENT_NAME
          Default SOAP Fault Detail name used when a validation errors occur on the request.
static String DEFAULT_FAULTSTRING_OR_REASON
          Default SOAP Fault string used when a validation errors occur on the request.
 
Fields inherited from class org.springframework.xml.transform.TransformerObjectSupport
logger
 
Constructor Summary
AbstractFaultCreatingValidatingInterceptor()
           
 
Method Summary
 boolean getAddValidationErrorDetail()
          Returns whether a SOAP Fault detail element should be created when a validation error occurs.
 QName getDetailElementName()
          Returns the fault detail element name when validation errors occur on the request.
 String getFaultStringOrReason()
          Sets the SOAP faultstring or Reason used when validation errors occur on the request.
 Locale getFaultStringOrReasonLocale()
          Returns the SOAP fault reason locale used when validation errors occur on the request.
protected  boolean handleRequestValidationErrors(MessageContext messageContext, SAXParseException[] errors)
          Template method that is called when the request message contains validation errors.
 void setAddValidationErrorDetail(boolean addValidationErrorDetail)
          Indicates whether a SOAP Fault detail element should be created when a validation error occurs.
 void setDetailElementName(QName detailElementName)
          Sets the fault detail element name when validation errors occur on the request.
 void setFaultStringOrReason(String faultStringOrReason)
          Sets the SOAP faultstring or Reason used when validation errors occur on the request.
 void setFaultStringOrReasonLocale(Locale faultStringOrReasonLocale)
          Sets the SOAP fault reason locale used when validation errors occur on the request.
 
Methods inherited from class org.springframework.ws.server.endpoint.interceptor.AbstractValidatingInterceptor
afterCompletion, afterPropertiesSet, getSchemaLanguage, getSchemas, getValidationRequestSource, getValidationResponseSource, handleFault, handleRequest, handleResponse, handleResponseValidationErrors, setErrorHandler, setSchema, setSchemaLanguage, setSchemas, setValidateRequest, setValidateResponse, setXsdSchema, setXsdSchemaCollection
 
Methods inherited from class org.springframework.xml.transform.TransformerObjectSupport
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DETAIL_ELEMENT_NAME

public static final QName DEFAULT_DETAIL_ELEMENT_NAME
Default SOAP Fault Detail name used when a validation errors occur on the request.

See Also:
setDetailElementName(javax.xml.namespace.QName)

DEFAULT_FAULTSTRING_OR_REASON

public static final String DEFAULT_FAULTSTRING_OR_REASON
Default SOAP Fault string used when a validation errors occur on the request.

See Also:
setFaultStringOrReason(String), Constant Field Values
Constructor Detail

AbstractFaultCreatingValidatingInterceptor

public AbstractFaultCreatingValidatingInterceptor()
Method Detail

getAddValidationErrorDetail

public boolean getAddValidationErrorDetail()
Returns whether a SOAP Fault detail element should be created when a validation error occurs. This detail element will contain the exact validation errors. It is only added when the underlying message is a SoapMessage. Defaults to true.

See Also:
SoapFault.addFaultDetail()

setAddValidationErrorDetail

public void setAddValidationErrorDetail(boolean addValidationErrorDetail)
Indicates whether a SOAP Fault detail element should be created when a validation error occurs. This detail element will contain the exact validation errors. It is only added when the underlying message is a SoapMessage. Defaults to true.

See Also:
SoapFault.addFaultDetail()

getDetailElementName

public QName getDetailElementName()
Returns the fault detail element name when validation errors occur on the request.


setDetailElementName

public void setDetailElementName(QName detailElementName)
Sets the fault detail element name when validation errors occur on the request. Defaults to DEFAULT_DETAIL_ELEMENT_NAME.

See Also:
DEFAULT_DETAIL_ELEMENT_NAME

getFaultStringOrReason

public String getFaultStringOrReason()
Sets the SOAP faultstring or Reason used when validation errors occur on the request.


setFaultStringOrReason

public void setFaultStringOrReason(String faultStringOrReason)
Sets the SOAP faultstring or Reason used when validation errors occur on the request. It is only added when the underlying message is a SoapMessage. Defaults to DEFAULT_FAULTSTRING_OR_REASON.

See Also:
DEFAULT_FAULTSTRING_OR_REASON

getFaultStringOrReasonLocale

public Locale getFaultStringOrReasonLocale()
Returns the SOAP fault reason locale used when validation errors occur on the request.


setFaultStringOrReasonLocale

public void setFaultStringOrReasonLocale(Locale faultStringOrReasonLocale)
Sets the SOAP fault reason locale used when validation errors occur on the request. It is only added when the underlying message is a SoapMessage. Defaults to English.

See Also:
Locale.ENGLISH

handleRequestValidationErrors

protected boolean handleRequestValidationErrors(MessageContext messageContext,
                                                SAXParseException[] errors)
                                         throws TransformerException
Template method that is called when the request message contains validation errors. This implementation logs all errors, returns false, and creates a client or sender SoapFault, adding a SoapFaultDetail with all errors if the addValidationErrorDetail property is true.

Overrides:
handleRequestValidationErrors in class AbstractValidatingInterceptor
Parameters:
messageContext - the message context
errors - the validation errors
Returns:
true to continue processing the request, false (the default) otherwise
Throws:
TransformerException

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.