Scarabanza
10 years agoNew Contributor
How do I validate a REST XML request using Groovy
I have a REST mock service with an OnRequest script that needs to apply XML validation to incoming requests. I found a post that explains how to do this for SOAP (viewtopic.php?t=2049), but I can't find anything that indicates how to do this for REST.
I have the XSD held in the WADL for the service, but I'm equally happy to store it in a file. I assume I need to achieve the following things, and any hints, tips, or complete solutions would be most welcome;
I'm quite surprised at how hard I'm finding this as I expected it to be trivial.
I have the XSD held in the WADL for the service, but I'm equally happy to store it in a file. I assume I need to achieve the following things, and any hints, tips, or complete solutions would be most welcome;
- Load the XSD - I can't find out the right combination of methods to get me this information (presumably starting from the mockRequest)
- Retrieve the request Xml - I can do this now I've downloaded the maintenance version of SoapUI 5
- Create some kind of Xml Validator and check the request against the XSD - Can I use the WSDL validator that is mentioned in the post above, or is there a REST based version?
I'm quite surprised at how hard I'm finding this as I expected it to be trivial.