diff --git a/core/src/main/java/org/springframework/ws/server/endpoint/AbstractMarshallingPayloadEndpoint.java b/core/src/main/java/org/springframework/ws/server/endpoint/AbstractMarshallingPayloadEndpoint.java
index b8f3f3f2..e164a090 100644
--- a/core/src/main/java/org/springframework/ws/server/endpoint/AbstractMarshallingPayloadEndpoint.java
+++ b/core/src/main/java/org/springframework/ws/server/endpoint/AbstractMarshallingPayloadEndpoint.java
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.util.Assert;
+import org.springframework.validation.Validator;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.support.MarshallingUtils;
@@ -50,6 +51,8 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
private Unmarshaller unmarshaller;
+ private Validator[] validators;
+
/**
* Creates a new AbstractMarshallingPayloadEndpoint. The {@link Marshaller} and {@link Unmarshaller}
* must be injected using properties.
@@ -119,6 +122,30 @@ public abstract class AbstractMarshallingPayloadEndpoint implements MessageEndpo
this.unmarshaller = unmarshaller;
}
+ /**
+ * Set the primary {@link Validator} for this endpoint. The {@link Validator} is must support the specified command
+ * class. If there are one or more existing validators set already when this method is called, only the specified
+ * validator will be kept. Use {@link #setValidators(Validator[])} to set multiple validators.
+ */
+ public final void setValidator(Validator validator) {
+ this.validators = new Validator[]{validator};
+ }
+
+ /** Return the primary Validator for this controller. */
+ public final Validator getValidator() {
+ return (this.validators != null && this.validators.length > 0 ? this.validators[0] : null);
+ }
+
+ /** Set the Validators for this controller. The Validator must support the specified command class. */
+ public final void setValidators(Validator[] validators) {
+ this.validators = validators;
+ }
+
+ /** Return the Validators for this controller. */
+ public final Validator[] getValidators() {
+ return validators;
+ }
+
public final void afterPropertiesSet() throws Exception {
Assert.notNull(getMarshaller(), "marshaller is required");
Assert.notNull(getUnmarshaller(), "unmarshaller is required");
diff --git a/core/src/main/java/org/springframework/ws/soap/server/endpoint/AbstractSoapFaultDefinitionExceptionResolver.java b/core/src/main/java/org/springframework/ws/soap/server/endpoint/AbstractSoapFaultDefinitionExceptionResolver.java
index f9ec1e81..7c2705c7 100644
--- a/core/src/main/java/org/springframework/ws/soap/server/endpoint/AbstractSoapFaultDefinitionExceptionResolver.java
+++ b/core/src/main/java/org/springframework/ws/soap/server/endpoint/AbstractSoapFaultDefinitionExceptionResolver.java
@@ -66,7 +66,8 @@ public abstract class AbstractSoapFaultDefinitionExceptionResolver extends Abstr
return false;
}
if (!StringUtils.hasLength(definition.getFaultStringOrReason())) {
- definition.setFaultStringOrReason(ex.getMessage());
+ String faultString = StringUtils.hasLength(ex.getMessage()) ? ex.getMessage() : ex.toString();
+ definition.setFaultStringOrReason(faultString);
}
SoapBody soapBody = ((SoapMessage) messageContext.getResponse()).getSoapBody();
SoapFault fault = null;
diff --git a/core/src/test/java/org/springframework/ws/soap/server/endpoint/SoapFaultMappingExceptionResolverTest.java b/core/src/test/java/org/springframework/ws/soap/server/endpoint/SoapFaultMappingExceptionResolverTest.java
index d1c140df..92ab39b1 100644
--- a/core/src/test/java/org/springframework/ws/soap/server/endpoint/SoapFaultMappingExceptionResolverTest.java
+++ b/core/src/test/java/org/springframework/ws/soap/server/endpoint/SoapFaultMappingExceptionResolverTest.java
@@ -16,6 +16,7 @@
package org.springframework.ws.soap.server.endpoint;
+import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import javax.xml.soap.MessageFactory;
@@ -167,5 +168,27 @@ public class SoapFaultMappingExceptionResolverTest extends XMLTestCase {
assertNull("Detail on fault", fault.getFaultDetail());
}
+ public void testResolveNoMessageException() throws Exception {
+ Properties mappings = new Properties();
+ mappings.setProperty(IOException.class.getName(), "SERVER");
+ resolver.setExceptionMappings(mappings);
+
+ MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+ SOAPMessage message = messageFactory.createMessage();
+ SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
+ MessageContext context = new DefaultMessageContext(new SaajSoapMessage(message), factory);
+
+ boolean result = resolver.resolveException(context, null, new IOException());
+ assertTrue("resolveException returns false", result);
+ assertTrue("Context has no response", context.hasResponse());
+ SoapMessage response = (SoapMessage) context.getResponse();
+ assertTrue("Response has no fault", response.getSoapBody().hasFault());
+ Soap11Fault fault = (Soap11Fault) response.getSoapBody().getFault();
+ assertEquals("Invalid fault code on fault", SoapVersion.SOAP_11.getServerOrReceiverFaultName(),
+ fault.getFaultCode());
+ assertEquals("Invalid fault string on fault", "java.io.IOException", fault.getFaultStringOrReason());
+ assertNull("Detail on fault", fault.getFaultDetail());
+ }
+
}
\ No newline at end of file
diff --git a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/inline.wsdl b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/inline.wsdl
deleted file mode 100644
index 8ffe9377..00000000
--- a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/inline.wsdl
+++ /dev/null
@@ -1,207 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/schema.xsd b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/schema.xsd
deleted file mode 100644
index fdc4d9a8..00000000
--- a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/builder/schema.xsd
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file