Hi Maz,

Can you follow the format at [1] and see whether it works? This explains
the sample 351 in ESB.

[1]
https://docs.wso2.com/display/ESB480/Sample+351%3A+Inline+script+mediation+with+JavaScript

On Wed, Jan 7, 2015 at 4:03 AM, Maz Lakadia <[email protected]> wrote:

> Hi, I'm using script mediator to mediate the response payload from my
> server. The unmediated response is:
>
>             {"origin":"202.37.75.130"}
>
> I then add in a mediator via source code, that should change "origin" to
> "IP_Address":
>
>             <outSequence>
> <script language="js"><![CDATA[
> old_payload = mc.getPayloadJSON();
> payload["IP_Address"] = old_payload["origin"];
> mc.setPayloadJSON(payload);
> ]]></script>
>                 <filter source="get-property('CORS_ORIGIN')" regex=".+">
>                     <then>
> <property name="Access-Control-Allow-Origin"
> expression="get-property('CORS_ORIGIN')" scope="transport"/>
>                         <property name="Access-Control-Expose-Headers"
> value="Assertion,X-Jwt-Assertion,X-User-Name,X-User-Domain"
> scope="transport"/>
>                     </then>
>                 </filter>
>                 <send/>
>             </outSequence>
>
> However, my response remains unchanged (same as the unmediated response).
> I do not know how I can fix this. Is there an error I am making?
>
> Thanks,
> Maz
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Awanthika Senarath
Software Engineer, WSO2 Inc.
Mobile: +94717681791
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to