Spring Web Services Framework

org.springframework.ws.soap.server.endpoint
Class AbstractFaultCreatingValidatingMarshallingPayloadEndpoint

java.lang.Object
  

extended by org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint
      extended by org.springframework.ws.server.endpoint.AbstractValidatingMarshallingPayloadEndpoint
          extended by org.springframework.ws.soap.server.endpoint.AbstractFaultCreatingValidatingMarshallingPayloadEndpoint
All Implemented Interfaces:
Aware, InitializingBean, MessageSourceAware, MessageEndpoint

public abstract class AbstractFaultCreatingValidatingMarshallingPayloadEndpoint
extends AbstractValidatingMarshallingPayloadEndpoint
implements MessageSourceAware

Extension of the AbstractValidatingMarshallingPayloadEndpoint which validates the request payload with Validator(s), and creates a SOAP Fault whenever the request message cannot be validated. The desired validators can be set using properties, and must support the request object.

The contents of the SOAP Fault can be specified by setting the addValidationErrorDetail, faultStringOrReason, or detailElementName properties.

Since:
1.0.2
Author:
Arjen Poutsma

Field Summary
static QName DEFAULT_DETAIL_ELEMENT_NAME
          Default SOAP Fault Detail name used when a global validation error 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.ws.server.endpoint.AbstractValidatingMarshallingPayloadEndpoint
DEFAULT_REQUEST_NAME
 
Fields inherited from class org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint
logger
 
Constructor Summary
AbstractFaultCreatingValidatingMarshallingPayloadEndpoint()
           
 
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.
 Locale getFaultLocale()
          Returns the locale for SOAP fault reason and validation message resolution.
 String getFaultStringOrReason()
          Sets the SOAP faultstring or Reason used when validation errors occur on the request.
protected  boolean onValidationErrors(MessageContext messageContext, Object requestObject, Errors 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.
 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 locale for SOAP fault reason and validation messages.
 void setMessageSource(MessageSource messageSource)
           
 
Methods inherited from class org.springframework.ws.server.endpoint.AbstractValidatingMarshallingPayloadEndpoint
getRequestName, getValidator, getValidators, onUnmarshalRequest, setRequestName, setValidator, setValidators
 
Methods inherited from class org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint
afterMarshallerSet, afterPropertiesSet, getMarshaller, getUnmarshaller, invoke, invokeInternal, onMarshalResponse, setMarshaller, setUnmarshaller
 
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 global validation error 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

AbstractFaultCreatingValidatingMarshallingPayloadEndpoint

public AbstractFaultCreatingValidatingMarshallingPayloadEndpoint()
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

getFaultLocale

public Locale getFaultLocale()
Returns the locale for SOAP fault reason and validation message resolution.


setFaultStringOrReasonLocale

public void setFaultStringOrReasonLocale(Locale faultStringOrReasonLocale)
Sets the locale for SOAP fault reason and validation messages. It is only added when the underlying message is a SoapMessage. Defaults to English.

See Also:
Locale.ENGLISH

setMessageSource

public final void setMessageSource(MessageSource messageSource)
Specified by:
setMessageSource in interface MessageSourceAware

onValidationErrors

protected final boolean onValidationErrors(MessageContext messageContext,
                                           Object requestObject,
                                           Errors 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.

Specified by:
onValidationErrors in class AbstractValidatingMarshallingPayloadEndpoint
Parameters:
messageContext - the message context
errors - the validation errors
requestObject - the object unmarshalled from the request
Returns:
true to continue processing the request, false (the default) otherwise
See Also:
Errors.getAllErrors()

Spring Web Services Framework

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