The following sample demonstrate how to encode a string in WSO2 ESB and how to check whether a string is encoded or not.
This is based on the regular expression given here to check whether a string is encoded or not.
<property name="string" value="abcd"/>
<property name="encodedString" expression="base64Encode('abcd')"/>
<log level="custom">
<property name="encodedString" expression="get-property('encodedString')"/>
</log>
<filter source="get-property('encodedString')"
regex="^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$">
<then>
<log level="custom">
<property name="encoded?" value="yes"/>
</log>
</then>
<else>
<log level="custom">
<property name="encoded?" value="no"/>
</log>
</else>
</filter>
This is based on the regular expression given here to check whether a string is encoded or not.
You might want to print the current thread id for testing purposes in WSO2 ESB. It might be useful in cases where you want to make sure that the same thread is used for all the operations and no new threads were created. You can add following script mediator in your proxy to print the current thread id.