Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSO2 ESB filter check null for get-property

Tags:

wso2

wso2esb

I want to check if a property is null in a filter condition. It might not exist in the context or it can be null as well. I want to cover both cases. How can I write a filter expression? I tried something like the code below, but it's not working

<filter xpath="(get-property('studentId')!=null)">

What is the correct way to achieve this?

like image 352
Janier Avatar asked Jul 04 '18 01:07

Janier


People also ask

How to manage errors in WSO2 ESB?

Once an error occurs users can perform various actions on those using the following options. One of the first things that can be done when an error occurs is to log the full error. When an error occurs the mediation engine used by WSO2 ESB tries to give maximum information via couple of properties.

How to retrieve query parameters from HTTP request using WSO2 ESB?

There are several ways to retrieve query parameters from an HTTP request using WSO2 ESB. There is an XPath variable $url which we can use to retrieve query parameters from an HTTP request. Following is an example using the $url. Note that you don’t have to mention the query params in the uri-template

Does WSO2 Enterprise Integrator support Standard XPath?

… The ESB profile of WSO2 Enterprise Integrator (WSO2 EI) supports standard XPath functions and variables through its underlying XPath engine. The ESB profile also provides custom XPath functions and variables for accessing message properties.

What happens when a fault is detected in WSO2?

Once a fault is detected a user can do various things such as log the full error, send a fault back to the client, send an alert email to the system administrator etc. WSO2 ESB's run time components such as sequences, proxy services can be equipped with a fault handler.


1 Answers

You can check the existence of property by using boolean XPath function as below

<filter source="boolean(get-property('yourProperty'))" regex="false">
    <then>
           <!-- NULL OR NON EXIST -->
    </then>
    <else>
           <!-- EXIST -->
    </else>
</filter>
like image 64
Chandana Avatar answered Sep 19 '22 11:09

Chandana