/** * Specialized form of xpath evaluation function.An xpath evaluate() will be performed using two contexts * (ie:-soap-envelope and on Synapse Message Context). This is useful for evaluating xpath on a * nodeset for function contexts (we need both nodeset and synapse ctxts for evaluating function * scope expressions) * @param primaryContext a context object ie:- a soap envelope * @param secondaryContext a context object ie:-synapse message ctxt * @return result */ public Object evaluate(Object primaryContext, MessageContext secondaryContext) { Object result = null; //if result is still not found use second ctxt ie:-syn-ctxt with a wrapper to evaluate if (secondaryContext != null) { try { //wrapper Context is used to evaluate 'dynamic' function scope objects result = evaluate(new ContextWrapper((SOAPEnvelope) primaryContext,secondaryContext)); } catch (Exception e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } else { try { result = evaluate(primaryContext); } catch (JaxenException e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } return result; }
new ContextSupport(baseContextSupport.getNamespaceContext(), baseContextSupport.getFunctionContext(), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), wrapper.getMessageCtxt(), wrapper.getEnvelope()), baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(wrapper.getEnvelope())); return context; } else {
new ContextSupport(baseContextSupport.getNamespaceContext(), baseContextSupport.getFunctionContext(), new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), wrapper.getMessageCtxt(), wrapper.getEnvelope()), baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(wrapper.getEnvelope())); return context; } else {
/** * Specialized form of xpath evaluation function.An xpath evaluate() will be performed using two contexts * (ie:-soap-envelope and on Synapse Message Context). This is useful for evaluating xpath on a * nodeset for function contexts (we need both nodeset and synapse ctxts for evaluating function * scope expressions) * @param primaryContext a context object ie:- a soap envelope * @param secondaryContext a context object ie:-synapse message ctxt * @return result */ public Object evaluate(Object primaryContext, MessageContext secondaryContext) { Object result = null; //if result is still not found use second ctxt ie:-syn-ctxt with a wrapper to evaluate if (secondaryContext != null) { try { //wrapper Context is used to evaluate 'dynamic' function scope objects result = evaluate(new ContextWrapper((SOAPEnvelope) primaryContext,secondaryContext)); } catch (Exception e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } else { try { result = evaluate(primaryContext); } catch (JaxenException e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } return result; }