筛选器中介的wso2响应属性

筛选器中介的wso2响应属性,wso2,wso2esb,wso2carbon,Wso2,Wso2esb,Wso2carbon,我正在尝试对我的响应使用筛选器中介来检查响应是否为集合 所以我在这里做的是检查集合中的元素id是否为数字 <property expression="/soapenv:Envelope/soapenv:Body/root:movie/belongs_to_collection/id" name="collection" scope="default" type="STRING"/> <filter description="" regex="[0-9]+" source="ge

我正在尝试对我的响应使用筛选器中介来检查响应是否为集合

所以我在这里做的是检查集合中的元素id是否为数字

<property expression="/soapenv:Envelope/soapenv:Body/root:movie/belongs_to_collection/id" name="collection" scope="default" type="STRING"/>
<filter description="" regex="[0-9]+" source="get-property('collection')">...</filter>

...
这是我的完整api配置

下面是需要过滤的响应

如果在表达式中使用名称空间前缀,则需要定义这些名称空间。例如:

    <property expression="/root:movie/belongs_to_collection/id" 
name="collection" scope="default" type="STRING" xmlns:root="www.wso2esb.com"/>

然而,我在使用API时看到的响应是

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <jsonObject>
            <belongs_to_collection>
                <id>8650</id>
...

8650
...
您的根元素是soapenv:Envelope标记,因此您不必再将其放入表达式中。开头的/指的是根元素。之后的任何内容都引用根元素中的元素

因此,表达式应如下所示:

<property xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
name="collection" expression="/soapenv:Body/jsonObject/belongs_to_collection/id" 
scope="default" type="STRING"/>

如果不想处理名称空间,可以像这样使用
local-name()

<property name="collection" 
expression="//*[local-name()='belongs_to_collection']/*[local-name()='id']/text()" 
scope="default" 
type="STRING"/>


Kevin,你的问题是什么?我提供的api配置不起作用。我还尝试使用日志中介打印集合属性,但它没有显示任何内容。”所以我怀疑这个属性是否真的有效
另一个选项是使用
local-name()