简体   繁体   English

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

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

I'm trying to handle the response in the out sequence by using filter mediator with condition as (Vin number Updated Successfully) if it's satisfy Then block needs to be excluded but instead of Then block the else block is executed so Please tell me what did I mistaken in the below mentioned code.我正在尝试通过使用条件为(Vin 编号已成功更新)的过滤器调解器来处理输出序列中的响应,如果满足则需要排除块,而不是执行 else 块,而不是执行 else 块,请告诉我做了什么我在下面提到的代码中弄错了。 Thanks!谢谢!

 <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>

日志

The property ComsResponse is probably empty. ComsResponse 属性可能为空。

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

The json-eval statement is looking for a ComsResponse element/key within the message. json-eval 语句正在消息中寻找 ComsResponse 元素/键。 This does not exist as the result of just $.这不作为 $ 的结果而存在。 is only a string.只是一个字符串。

So currently the filter is testing the regex against an empty string.因此,目前过滤器正在针对空字符串测试正则表达式。 Try setting the Response property as follows:尝试如下设置 Response 属性:

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

For more details on the json-eval function check the WSO2 documentation.有关 json-eval 函数的更多详细信息,请查看WSO2 文档。

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

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