在过滤器介体中使用XPath函数 [英] Using XPath functions in filter mediator
问题描述
在代理的不连续性中,我正在中使用xpath查询进行过滤过滤器介体.但是我想使用XPath函数,例如exists()
或count()
.但这是行不通的,并且总是会产生异常.这是我的示例:
In my inSequence of a proxy I'm filtering with a xpath query in the filter mediator. But I want to use XPath functions like exists()
or count()
. But this does not work and always creates an exception. Here my example:
<filter xpath="count($body/myElement)>2">
<drop/>
</filter>
还有我总是得到的例外:
And the exception I always get:
ERROR - FilterMediator Error evaluating XPath expression : n:exists($body/avintis:Exception)
org.jaxen.UnresolvableException: No Such Function exists
如何使这些功能起作用?
How can I make these functions work?
推荐答案
您可以将xpath函数与过滤器介体一起使用,以修改突触段,如下所示.
You can use xpath functions with filter mediator as modifying your synapse segment as shown below.
<filter xpath="fn:exists($body/myElement)">
<drop/>
</filter>
您可以参考样本156:服务集成,并指定[1]中可用的接收顺序以用于进一步的样本.
You can refer for Sample 156: Service Integration with specifying the receiving sequence available at [1] for further sample.
<filter xpath="fn:number(get-property('SIMPLE_SER_AMT')) > fn:number(get-property('SECURE_SER_AMT'))">
[1]. http://wso2.org/project/esb/java/4.0.3/docs/samples/proxy_samples.html
谢谢, 达沙那(Dharshana)
Thank You, Dharshana
这篇关于在过滤器介体中使用XPath函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!