在Spring WS 2.0.0 for PayLoadValidatingInterceptor 中,通过验证我的xsd请求文件,发现验证错误时只显示一条必填字段错误消息 . 我想得到的是xsd架构文件中所有必需的字段错误信息( nillable=false ) .

在我的Customer.xsd架构文件中 .

<xs:element name="firstname" nillibale="false" type="xs:string"/>
<xs:element name="middlename" nillibale="false" type="xs:string"/>
<xs:element name="lastname" nillibale="false" type="xs:string"/>

并且,当使用 PayLoadValidatingInterceptor 进行验证时,仅显示一条错误消息,即需要'firstname' . 但是,在我的观点中,我必须在验证时获得所有错误消息('firstname','middlename','lastname') .

在我的配置文件中

<sws:interceptors>
     <bean id="validatingInterceptor"
        class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
         <property name="schema" value="classpath:schema/Customer.xsd"/>
         <property name="validateRequest" value="true"/>
         <property name="validateResponse" value="true"/>
     </bean>
</sws:interceptors>

P.S:没有使用日志记录,我使用SoapUI Tool进行测试 .

而且,输出是......

<SOAP-ENV:Fault>
     <faultcode>SOAP-ENV:Client</faultcode>
     <faultstring xml:lang="en">Validation error</faultstring>
     <detail>
          <spring-ws:ValidationError xmlns:spring-ws="springframework.org/spring-ws">cvc-complex-type.2.4.b: The content of element 'cus:customer' is not complete. One of '{"customer.model.web.insurance.ace.org":firstname'; is expected.</spring-ws:ValidationError> 
     </detail>
</SOAP-ENV:Fault>

在我看来,我想得到的是......

<SOAP-ENV:Fault>
     <faultcode>SOAP-ENV:Client</faultcode>
     <faultstring xml:lang="en">Validation error</faultstring>
     <detail>
          <spring-ws:ValidationError xmlns:spring-ws="springframework.org/spring-ws">cvc-complex-type.2.4.b: The content of element 'cus:customer' is not complete. One of '{"customer.model.web.insurance.ace.org":firstname'; is expected.</spring-ws:ValidationError> 
          <spring-ws:ValidationError xmlns:spring-ws="springframework.org/spring-ws">cvc-complex-type.2.4.b: The content of element 'cus:customer' is not complete. One of '{"customer.model.web.insurance.ace.org":middlename'; is expected.</spring-ws:ValidationError>
          <spring-ws:ValidationError xmlns:spring-ws="springframework.org/spring-ws">cvc-complex-type.2.4.b: The content of element 'cus:customer' is not complete. One of '{"customer.model.web.insurance.ace.org":lastname'; is expected.</spring-ws:ValidationError>
     </detail>
</SOAP-ENV:Fault>