// perform transformation
transformer.transform(transformSrc, transformTgt);
StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(baosForTarget.toByteArray()));
OMContainer parent = sourceNode.getParent();
OMElement result = builder.getDocumentElement();
log.debug("Transformation result : " + result);
if (parent instanceof SOAPEnvelope) {
((SOAPEnvelope) parent).getBody().getFirstOMChild().detach();
((SOAPEnvelope) parent).getBody().setFirstChild(result);
} else {
parent.getFirstOMChild().detach();
parent.addChild(result);
}
} catch (MalformedURLException mue) {
handleException(mue);
} catch (TransformerConfigurationException tce) {