KeyStore keyStore = SecurityUtils.loadKeyStore(keyStorePath,keyStorePassword);
KeyPair keyPair = SecurityUtils.getKeyPair(keyStore,keyAlias,keyPassword);
CachedOutputStream os = (CachedOutputStream)message.getContent(OutputStream.class);
StringBuilder sb = new StringBuilder();
os.writeCacheTo(sb);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
Document document = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(sb.toString().getBytes()));