Trying to retrieve the SOAP body from a SOAP response, but getting this error:
NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
Document doc = soapResMsg.getSOAPBody().extractContentAsDocument(); -- Exception is thrown here
org.dom4j.io.DOMReader d4Reader = new org.dom4j.io.DOMReader();
org.dom4j.Document d4doc = d4Reader.read(doc);
Using Saaj1.4
What would be a fix for this?
I solved this by making the DocumentBuilderFactory namespace aware:
DocumentBuilderFactory.setNamespaceAware(true)