private OMNode getTransformSource(MessageContext synCtx) {
// Do not change source, if none was specified. else will cause issues
// for concurrent messages and reuse of the mediator instance
AXIOMXPath sourceXPath = source;
if (sourceXPath == null) {
try {
log.debug("Transform source XPath was not specified.. defaulting to SOAP Body");
sourceXPath = new AXIOMXPath("//SOAP-ENV:Body");
sourceXPath.addNamespace("SOAP-ENV", synCtx.isSOAP11() ?
SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
} catch (JaxenException e) {}
}
try {
log.debug("Transformation against source element evaluated by : " + sourceXPath);
Object o = sourceXPath.evaluate(synCtx.getEnvelope());
if (o instanceof OMNode) {
return (OMNode) o;
} else if (o instanceof List && !((List) o).isEmpty()) {
return (OMNode) ((List) o).get(0); // Always fetches *only* the first
} else {