繁体   English   中英

过滤介质在 WSO2 EI 6.6 中无法正常工作

[英]Filter mediator not working Properly in WSO2 EI 6.6

我正在尝试通过使用条件为(Vin 编号已成功更新)的过滤器调解器来处理输出序列中的响应,如果满足则需要排除块,而不是执行 else 块,而不是执行 else 块,请告诉我做了什么我在下面提到的代码中弄错了。 谢谢!

 <outSequence>
        <log level="custom">
            <property expression="json-eval($.)" name="===Response from COMS==="/>
        </log>
        <log level="custom">
            <property expression="json-eval($)" name="ComsResponse"/>
        </log>
        <property expression="json-eval($.ComsResponse)" name="Response" scope="default" type="STRING"/>
        <filter regex="Vin number Updated Successfully" source="$ctx:Response">
            <then>
                <payloadFactory description="Form Response Payload" media-type="json">
                    <format>{"StatusCode":"$1","Message":"$2"}</format>
                    <args>
                        <arg value="200"/>
                        <arg value="Updated Sucessfully"/>
                    </args>
                </payloadFactory>
            </then>
            <else>
                <payloadFactory description="Form Response Payload" media-type="json">
                    <format>{"StatusCode":"$1","Message":"$2"}</format>
                    <args>
                        <arg value="400"/>
                        <arg value="Unable to Created or Vin Number already exist"/>
                    </args>
                </payloadFactory>
            </else>
        </filter>
        <respond/>
        <property description="HTTPStatusCode" name="HTTP_SC" scope="axis2" type="STRING" value="200"/>
        <property description="HttpMessageType" name="messageType" scope="axis2" type="STRING" value="application/json"/>
    </outSequence>

日志

ComsResponse 属性可能为空。

<property expression="json-eval($.ComsResponse)" name="Response" scope="default" type="STRING"/> 

json-eval 语句正在消息中寻找 ComsResponse 元素/键。 这不作为 $ 的结果而存在。 只是一个字符串。

因此,目前过滤器正在针对空字符串测试正则表达式。 尝试如下设置 Response 属性:

<property expression="json-eval($.)" name="Response" scope="default" type="STRING"/>

有关 json-eval 函数的更多详细信息,请查看WSO2 文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM