Since Spring WS doesn’t use a service contract, you must know the request and response type.

The test below demonstrates how to create and instantiate a request object of a JAXB generated class, call the marshall Send And Receive method with it and how to cast the response object to an object of the JAXB generated response class.

spring ws payloadvalidatinginterceptor-24

The Spring WS client is a lightweight alternative that doesn’t need a WSDL to work.

You code against a template like Spring’s other templates for communicating against a database or JMS server.

The code used in this article was developed in my work time at Redpill Linpro.

Info: This example only covers the validation part and extends from our existing Produce Spring WS contract-first soap service tutorial. Endpoint Interceptor; import org.soap.server.endpoint.interceptor.

I implemented two test cases inside our Spring JUnit4Class Runner using the springframework.xml-validator engine and validation classes to validate the payload outside of the WS against the schema. Does anybody knows a reason why the validation inside the WS behaves different to the manual validation?

I'm walking through the following tutorial: and I faced a problem.

Thanks Anil As far as I know, it should work with the the configured XSD files.

Perhaps you didn't correctly define a field to be mandatory in your XSD?

The client part of Spring WS can validate the parsed XML before it sends the XML document.