ReadyAPI DocumentationTesting APIsScriptingGroovy Scripting SamplesValidate Response Against XSD SchemaValidate Response Against XSD SchemaBy using a Groovy assertion, you can validate a response against an XSD schema.Where to useYou can run this script as a Groovy assertion.ExampleGroovyimport javax.xml.XMLConstants import javax.xml.transform.stream.StreamSource import javax.xml.validation.SchemaFactory // Specify an XSD Schema def xsdFilePath = "C:\\temp\\Schema.xsd" // Get the response as XML def response = messageExchange.getResponse().contentAsXml // Create validation objects def factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) def schema = factory.newSchema(new StreamSource(xsdFilePath)) def validator = schema.newValidator() // Validate the response against the schema assert validator.validate(new StreamSource(new StringReader(response))) == null See AlsoRequest Editor InterfaceScripting