滤镜中介器在WSO2 EI 6.6中无法正常工作
我正在尝试通过将过滤器调解器与条件(成功更新的VIN编号更新)在OUT序列中处理响应我在下面提到的代码中误解了。谢谢!
<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>
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. 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
属性comsresponse可能是空的。
JSON-EVAL语句正在寻找消息中的comsresponse元素/键。这不仅是$。只是一个字符串。
因此,目前,过滤器正在针对空字符串测试正则条件。尝试设置响应属性如下:
有关JSON-EVAL功能的更多详细信息,请检查 wso2文档。
The property ComsResponse is probably empty.
The json-eval statement is looking for a ComsResponse element/key within the message. 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:
For more details on the json-eval function check the WSO2 documentation.