Results 1 to 6 of 6

Thread: PayloadValidatingInterceptor doesn't validate response

  1. #1
    Join Date
    Jan 2009
    Posts
    29

    Default PayloadValidatingInterceptor doesn't validate response

    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:
    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>
    The contents of general.xsd:
    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:
    Code:
    <ns:getServerVersionResponse xmlns:ns="http://general/xsd/">
            <ns:return>4.9.0</ns:return>
    </ns:getServerVersionResponse>
    Have I just completely missed something here?

  2. #2
    Join Date
    Aug 2009
    Posts
    7

    Default

    It looks like you have turned off validation on the request:

    <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>

  3. #3
    Join Date
    Jan 2009
    Posts
    29

    Default

    Quote Originally Posted by boz0413 View Post
    It looks like you have turned off validation on the request:

    Yes, that is my intent. I only want to validate the response that I send back to the client, but the PayloadValidatingInterceptor does not honor my xs:integer definition in the schema.

  4. #4
    Join Date
    Dec 2008
    Posts
    2

    Default

    Hi,
    Were you able to solve this issue? I'm getting the same error. Pls let me know if you have solution.

  5. #5
    Join Date
    Jan 2009
    Posts
    29

    Default

    No, I never got it to work.

    I have moved on to a new project since then.

  6. #6
    Join Date
    Nov 2007
    Posts
    17

    Default

    PayloadValidatingInterceptor does not throw an exception or return fault if the response is not valid. It only logs WARNing. It actually makes sense, you usually do not want to return fault in such case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •