private void assertValidXML(final Node request) {
        ByteArrayInputStream stream = new ByteArrayInputStream(
                request.getBody().toXML().getBytes());
        StreamSource source = new StreamSource(stream);
        Throwable thr;
        try {
            synchronized(VALIDATOR) {
                VALIDATOR.validate(source);
            }
            return;
        } catch (IOException iox) {
            thr = iox;
        } catch (SAXException saxx) {
            thr = saxx;
        }
        fail("Request XML validation failed: " + thr.getMessage());
    }