I will be mapping resources that are in a particular format into another format. This means I will have a lot of template mappings that I could load into script mediator and let it use the appropriate one for the task. I am unsure of how I could do that will payload factory mediator. Do you have any clues?Date: Wed, 7 Jan 2015 09:07:13 +0530 Subject: Re: [Dev] Payload mediation of JSON message using Script Mediator From: [email protected] To: [email protected] CC: [email protected]; [email protected]
What is the real motivation you to use script mediator instead of payload factory? You can easly construct jaon payload with payload factory On Wednesday, January 7, 2015, Awanthika Senarath <[email protected]> wrote: 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 -- Sent from Gmail Mobile
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
