Methods Summary |
---|
private javax.xml.soap.SOAPMessage | getSOAPMessageFromString(java.lang.String str)
MimeHeaders mimeHeaders = new MimeHeaders();
mimeHeaders.addHeader("content-type", "text/xml");
SOAPMessage message = MessageFactory.newInstance().createMessage(
mimeHeaders,
new ByteArrayInputStream(str.getBytes()));
return message;
|
private org.w3c.dom.Document | testImportFromDomToSaaj(org.w3c.dom.Document doc)
SOAPMessage sm = MessageFactory.newInstance().createMessage();
SOAPPart sp = sm.getSOAPPart();
SOAPBody body = sm.getSOAPBody();
org.w3c.dom.Node node = sp.importNode(doc.getDocumentElement(), true);
body.appendChild(node);
return sp;
|
private org.w3c.dom.Document | testImportFromSaajToDom()
SOAPMessage message = getSOAPMessageFromString(SAMPLE_1);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
org.w3c.dom.Node fromNode = message.getSOAPBody().getFirstChild();
Node n = doc.importNode(fromNode, true);
doc.appendChild(n);
return doc;
|
public void | testImports()
//DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//DocumentBuilder db = dbf.newDocumentBuilder();
//Document doc1 = db.parse(new ByteArrayInputStream(SAMPLE_1.getBytes()));
Document doc2 = testImportFromSaajToDom();
Document body = testImportFromDomToSaaj(doc2);
XMLUtils.PrettyDocumentToStream(body, System.out);
//assertXMLEqual(doc1, body);
//assertXMLEqual(doc2, body);
//assertXMLEqual(doc1, doc2);
|