You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docbkx/server.xml
+119Lines changed: 119 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -718,6 +718,125 @@ public class MarshallingOrderEndpoint extends AbstractMarshallingPayloadEndpoint
718
718
<literal>marshaller</literal> bean.
719
719
</para>
720
720
</section>
721
+
<section>
722
+
<title>Using Spring <interfacename>Validator</interfacename> with Marshalling Endpoints</title>
723
+
<para>
724
+
It is possible to use <ulinkurl="http://static.springframework.org/spring/docs/2.5.x/reference/validation.html#validator"><interfacename>Validator</interfacename></ulink>
725
+
objects in conjunction with marshalling endpoints in order to validate the unmarshalled payloads.
726
+
Spring-WS provides 2 extensions of <classname>AbstractMarshallingPayloadEndpoint</classname> for that purpose:
727
+
<classname>AbstractValidatingMarshallingPayloadEndpoint</classname> and
728
+
<classname>AbstractFaultCreatingValidatingMarshallingPayloadEndpoint</classname>. The former is the most
729
+
general whereas the latter specializes in creating SOAP faults in response to validation errors.
730
+
</para>
731
+
<para>
732
+
Both classes support setting one or more <interfacename>Validator</interfacename> objects via the
733
+
<property>validator</property> and <property>validators</property> properties respectively.
734
+
Note that all of the injected validators
735
+
<emphasisrole="bold">must</emphasis> support the request object (through the <methodname>supports</methodname> method)
736
+
or else an <exceptionname>IllegalArgumentException</exceptionname> will be thrown.
737
+
</para>
738
+
<note>
739
+
<para>
740
+
The default request object name used in the validator is <literal>request</literal>.
741
+
The error codes are generated in consequence. For instance, assuming a POJO with a
742
+
"<property>name</property>" property of type <literal>java.lang.String</literal>,
743
+
calling <methodname>errors.rejectValue("name","invalidValue")</methodname> in the
744
+
<methodname>validate</methodname> method of a <interfacename>Validator</interfacename>
It is possible though to customize various aspects of the generated SOAP faults, such as the fault string
834
+
and the soap detail.
835
+
Please refer to the <ulinkurl="http://static.springframework.org/spring-ws/site/apidocs/org/springframework/ws/soap/server/endpoint/AbstractFaultCreatingValidatingMarshallingPayloadEndpoint.html">Javadoc</ulink>
0 commit comments