Hi Aman,

You can add the resulting string to the message context as a property

@Override
public boolean mediate(MessageContext messageContext) {
    String result = "This is the resulting String";
    messageContext.setProperty("sampleProperty",result);
    return true;

Then, inside the proxy/API we can read that property as below

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="testClass"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <class name="mediator.TestMediator"/>
         <log>
            <property expression="*get-property('sampleProperty')*"
name="Property_from_class"/>
         </log>
         <drop/>
      </inSequence>
   </target>
   <description/>
</proxy>

Thanks,
Lahiru

On Wed, Aug 8, 2018 at 5:20 PM Aman Singh <amansingh0...@gmail.com> wrote:

> Dear Lahiru,
>
> I have created a custom JAVA class, which produces a "string" as output on
> running that class.  In my WSO2 ESB, I am calling that class with help of
> Class Mediator.
>
> Can you please tell me how can I store the value returned by my JAVA class
> in say a LOG mediator or Property mediator or anything?
>
> Your help would be very much appreciated.
>
> Thank you,
> Aman.
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to