Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get property value in JavaScript with script mediator

Is there a way, inside the javascript code from WSO2 ESB's Script mediator, to get a property's value when this property has a scope different from "default" ?

In case of a property with default scope :

get-property('MyProperty') 

OR

<script language="js">
   mc.getProperty("MyProperty");
</script>

In case of a property with 'transport' scope :

get-property('transport','FILE_NAME')

OR

<script language="js">
   mc.????????
</script>
like image 657
Jean-Michel Avatar asked Sep 20 '26 21:09

Jean-Michel


1 Answers

It seems that you can not get properties of other scopes than synapse using

mc.get-property("Property Name")

since mc is instance of Synapse.MessageContext in order to get other message context properties I do something like this in java, I don't know that if it is applicable in javascript or not. I do this for axis2 message context properties. Here "context" is the instance of Synapse.MessageContext.

org.apache.axis2.context.MessageContext axis2MessageContext;
            axis2MessageContext = ((Axis2MessageContext)context).getAxis2MessageContext();
like image 144
Reza Ameri Avatar answered Sep 22 '26 12:09

Reza Ameri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!