PayloadValidatingInterceptor seems to allow just about anything. I can define an element as "xs:integer", yet still set it to a non-integer value in my xml message. The only thing it seems to do is validate the schema when the applicationContext is loaded.
From the spring-ws-servlet.xml:
The contents of general.xsd:Code:<bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor"> <property name="schemas"> <list> <value>/WEB-INF/wsdl/general.xsd</value> </list> </property> <property name="validateRequest" value="false"/> <property name="validateResponse" value="true"/> </bean> <bean id="endpointMapping" class="org.springframework.ws.soap.server.endpoint.mapping.SoapActionEndpointMapping"> <property name="mappings"> <props> <prop key="urn:getServerVersion">getServerVersionEndpoint</prop> </props> </property> <property name="interceptors"> <list> <ref local="loggingInterceptor"/> <ref local="validatingInterceptor"/> </list> </property> </bean>
Code:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://general/xsd/" elementFormDefault="qualified" attributeFormDefault="qualified" targetNamespace="http://general/xsd/"> <xs:element name="getServerVersionResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="return" nillable="false" type="xs:integer"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
And now, the xml message that SHOULD cause a validation exception, because the value of "return" is not an integer:
Have I just completely missed something here?Code:<ns:getServerVersionResponse xmlns:ns="http://general/xsd/"> <ns:return>4.9.0</ns:return> </ns:getServerVersionResponse>


Reply With Quote
