1

I use WSO2 EI v6.5.0. I want to load username and password of an external SOAP service from the system environment variables into a payloadFactory mediator. Is it possible to use the $SYSTEM prefix in the section?

Arunan Sugunakumar
  • 2,862
  • 3
  • 9
  • 19

2 Answers2

1

This script mediator works in my case:

<script description="get cereditorials" language="js">
<![CDATA[mc.setProperty("user", java.lang.System.getenv("ENV_USER"));
         mc.setProperty("pwrd", java.lang.System.getenv("ENV_PWRD"));]]>
</script>
0

The $SYSTEM prefix is not supported yet. But you can use the following syntax to get system variables.

get-property('system', 'hello')

Arunan Sugunakumar
  • 2,862
  • 3
  • 9
  • 19
  • Thank you! I have tried this: `property name="UserName" expression="get-property('system', 'USERNAME')" ` But UserName is empty as a result. [This article](https://docs.wso2.com/display/EI650/Accessing+Properties+with+XPath#AccessingPropertieswithXPath-systemscope) says that I can retrieve Java System properties using the 'system'. [This answer](https://stackoverflow.com/questions/7054972/java-system-properties-and-environment-variables) says that System properties and Environment variables are quite different. It looks like 'get-property' is not fit to get environment variables. – Роман А. Dec 11 '20 at 13:06