I'm migrating from JBoss EAP 6.4
to EAP 7.1
. I've updated Apache CXF from 2.7.14 to 3.1.16 but now I'm missing the DOMUtils.writeXml(Node n, OutputStream os)
method. Which is the best way to replace it in a scenario like this?
SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
SOAPBody env = soapMessage.getSOAPPart().getEnvelope().getBody();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DOMUtils.writeXml(env, baos);
String soapBody = baos.toString();
I've replaced DOMUtils.writeXml(Node n, OutputStream os)
using javax.xml.transform.TransformerFactory
:
SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
SOAPBody env = message.getSOAPPart().getEnvelope().getBody();
javax.xml.transform.dom.DOMSource source = new javax.xml.transform.dom.DOMSource(env);
StringWriter stringResult = new StringWriter();
javax.xml.transform.TransformerFactory.newInstance().newTransformer().transform(source, new StreamResult(stringResult));
String soapBody = stringResult.toString();