Book Image

Spring Integration Essentials

By : CHANDAN K PANDEY
Book Image

Spring Integration Essentials

By: CHANDAN K PANDEY

Overview of this book

This book is intended for developers who are either already involved with enterprise integration or planning to venture into the domain. Basic knowledge of Java and Spring is expected. For newer users, this book can be used to understand an integration scenario, what the challenges are, and how Spring Integration can be used to solve it. Prior experience of Spring Integration is not expected as this book will walk you through all the code examples.
Table of Contents (12 chapters)
11
Index

Validating XML messages

While we are discussing XML transformation, it's relevant to bring up the validation aspect of the XML payload. Prevalidation of XML will save the system from going in an erroneous condition and can act at the source. Spring Integration provides support for XML validation via a filter:

<int-xml:validating-filter 
  id="feedXMLValidator" 
  input-channel="feedsReadChannel" 
  output-channel="feedsWriteChannel" 
  discard-channel="invalidFeedReads" 
  schema-location="classpath:xsd/feeds.xsd" />

The schema-location element defines the XSD that should be used for validation. This is optional and if it has not done so, set it to default xml-schema, which internally translates to org.springframework.xml.validation.XmlValidatorFactory#SCHEMA_W3C_XML.

We discussed a lot of inbuilt transformers, primarily dealing with XML payloads. Apart from these, Spring Integration provides many out-of-the-box transformers for...