code: private void validateSoapMessage(Document soapMessage, ErrorHandler eh)
              throws Exception {
          String namespace = soapMessage.getDocumentElement().getNamespaceURI();
  
          if (namespace == null) {
              throw new Exception(
                      "Error: SOAP message cannot be validated. The returned response may be an HTML response: "
                              + DomUtils.serializeNode(soapMessage));
          }
  
          // Create SOAP validator
          SchemaFactory sf = SchemaFactory
                  .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
          Schema soap_schema = null;
          if (namespace.equals(SOAP_12_NAMESPACE)) {
              soap_schema = sf.newSchema(Misc
                      .getResourceAsFile("com/occamlab/te/schemas/soap12.xsd"));
          } else /* if (namespace.equals(SOAP_11_NAMESPACE)) */{
              soap_schema = sf.newSchema(Misc
                      .getResourceAsFile("com/occamlab/te/schemas/soap11.xsd"));
          }
  
          Validator soap_validator = soap_schema.newValidator();
          soap_validator.setErrorHandler(eh);
          soap_validator.validate(new DOMSource(soapMessage));
      }
docs: A method to validate the SOAP message received. The message is validated
  against the propoer SOAP Schema (1.1 or 1.2 depending on the namespace of
  the incoming message)
  
  @param soapMessage
  the SOAP message to validate.
  @param eh
  the error handler.
  
  @author Simone Gianfranceschi