code: public static void validateMessage(String basePath, Document wsdl, SOAPMessage msg) throws XSDFormatException, XSDValidationException{
          LOG.debug("Validating message on WSDL");
  
          //get schema
          //Element schemaNode = (Element)wsdl.getElementsByTagNameNS(XMLConstants"http://www.w3.org/2001/XMLSchema","schema").item(0);
          NodeList schemaNodes = wsdl.getElementsByTagNameNS(
                  XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
  
          int nrSchemas = schemaNodes.getLength();
  
          Source[] schemas = new Source[nrSchemas];
  
          for (int i = 0; i < nrSchemas; i++) {
              schemas[i] = new DOMSource(schemaNodes.item(i));
          }
  
          //get body
          Element body = null;
          try {
              body = msg.getSOAPBody();
          } catch (SOAPException e) {
              throw S1SystemError.wrap(e);
          }
  
          if(msg.getAttachments().hasNext()){
              //copy
              body = (Element)body.cloneNode(true);
              //remove xop:Includes
              NodeList nl = body.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include","Include");
              for(int i=0;i<nl.getLength();i++){
                  Node n = nl.item(i);
                  n.getParentNode().removeChild(n);
              }
          }
  
          //validate Body children
          for(Element el:XMLFormat.getChildElementList(body,null,null)){
              XMLFormat.validate(basePath, schemas, el);
          }
      }
docs: Validate message on wsdl
  
  @param wsdl
  @param msg
  @throws XSDFormatException
  @throws XSDValidationException