public static DocumentFragment createWSAEPR(String uri) { Document doc; try { doc = new SourceTransformer().createDocument(); } catch (Exception e) { throw new RuntimeException(e); } DocumentFragment epr = doc.createDocumentFragment(); Element root = doc.createElement("epr"); Element address = doc.createElementNS(WSAddressingConstants.WSA_NAMESPACE_200508, WSAddressingConstants.WSA_PREFIX + ":" + WSAddressingConstants.EL_ADDRESS); Text txt = doc.createTextNode(uri); address.appendChild(txt); root.appendChild(address); epr.appendChild(root); return epr; }
public void buildAggregate(Object aggregation, NormalizedMessage message, MessageExchange exchange, boolean doTimeout) throws Exception { NormalizedMessage[] messages = ((SplitterAggregation) aggregation).messages; String correlationId = ((SplitterAggregation) aggregation).correlationId; SourceTransformer st = new SourceTransformer(); Document doc = st.createDocument(); Element root = createChildElement(aggregateElementName, doc); root.setAttribute(countAttribute, Integer.toString(messages.length)); for (int i = 0; i < messages.length; i++) { if (messages[i] != null) { Element elem = st.toDOMElement(messages[i]); if (messageElementName != null) { Element msg = createChildElement(messageElementName, root); msg.setAttribute(indexAttribute, Integer.toString(i)); msg.appendChild(doc.importNode(elem, true)); } else { root.appendChild(doc.importNode(elem, true)); } if (isCopyProperties()) { copyProperties(messages[i], message); } if (isCopyAttachments()) { copyAttachments(messages[i], message); } } } message.setContent(new DOMSource(doc)); message.setProperty(AbstractSplitter.SPLITTER_CORRID, correlationId); }
Node targetResultNode = getDOMNode(targetResultMessage.getContent()); Document document = new SourceTransformer().createDocument(); Element enricherElement = createChildElement(enricherElementName, document); Element requestElement = createChildElement(requestElementName, document);
public void marshal(MessageExchange exchange, NormalizedMessage message, Object body) throws MessagingException { if (useDOM) { try { Document document = transformer.createDocument(); getXStream().marshal(body, new DomWriter(document)); message.setContent(new DOMSource(document)); } catch (ParserConfigurationException e) { throw new MessagingException("Failed to marshal: " + body + " to DOM document: " + e, e); } } else { String xml = getXStream().toXML(body); message.setContent(new StringSource(xml)); } }