org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
.parse(new ByteArrayInputStream(out.toByteArray()));
SOAPBody body = msg.getSOAPBody();
Node port = body.getChildNodes().item(0);
port.appendChild(doc.getFirstChild().getFirstChild());
appendChild,添加节点的时候提示A node is used in a different document than the one that created it.
请问要怎么办?谢谢!
另外一个Document不能像当前的Document 添加节点
Document respDoc = body.getOwnerDocument();
port.appendChild(respDoc.adoptNode(doc.getFirstChild()));