List of usage examples for javax.xml.soap SOAPBody appendChild
public Node appendChild(Node newChild) throws DOMException;
newChild
to the end of the list of children of this node. From source file:com.googlecode.ddom.saaj.SOAPMessageTest.java
/** * Tests that {@link SOAPMessage#writeTo(java.io.OutputStream)} performs namespace repairing. * //from w w w.j a v a 2 s . co m * @throws Exception */ @Validated @Test public void testWriteToNamespaceRepairing() throws Exception { SOAPMessage message = getFactory().createMessage(); SOAPPart part = message.getSOAPPart(); SOAPBody body = part.getEnvelope().getBody(); body.appendChild(part.createElementNS("urn:ns", "p:test")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); message.writeTo(baos); String content = baos.toString("UTF-8"); assertTrue(content.contains("<p:test xmlns:p=\"urn:ns\"/>")); }