diff --git a/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java b/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java index 135b0a4e98..34f20e3655 100644 --- a/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java +++ b/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java @@ -57,6 +57,7 @@ import org.apache.synapse.util.resolver.ResourceMap; import org.apache.synapse.util.resolver.UserDefinedXmlSchemaURIResolver; import org.apache.synapse.util.xpath.SourceXPathSupport; +import org.apache.synapse.util.xpath.SynapseExpression; import org.apache.synapse.util.xpath.SynapseJsonPath; import org.apache.synapse.util.xpath.SynapseXPath; import org.xml.sax.SAXException; @@ -279,10 +280,11 @@ public boolean mediate(MessageContext synCtx) { String jsonPayload = null; if (sourcePath != null) { //evaluating - if (sourcePath instanceof SynapseJsonPath) { + if (sourcePath instanceof SynapseJsonPath || sourcePath instanceof SynapseExpression) { jsonPayload = sourcePath.stringValueOf(synCtx); } else { - handleException("Could not find the JSONPath evaluator for Source", synCtx); + handleException("Could not find JSONPath or Synapse Expression to extract the message " + + "to validate from the payload", synCtx); } } else { jsonPayload = JsonUtil.jsonPayloadToString(a2mc);