[Dev] Mediating a Server Response
Hi, I would like to mediate a response from my server. This mediation would be changing something like: { Quote:{ Current:{ High:-61.53602401623976, Last:62.32682938796667 }, Code:WSO2, Price:62.32682938796667 }, Status:NOT-OK} into { Estimate:{ Now:{ Max:-61.53602401623976 }, Company_Name:WSO2, Worth:62.32682938796667 }, Status:Not Good} What I need is to change the name of some fields, delete others, possibly modify the values of some fields and add some fields. What mediator(s) would you suggest I use for such a task. Thanks, Maz ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Mediating a Server Response
Hi Maz, WSO2 ESB provides the following mediators which you can use to transform a message. 1) Enrich mediator - For simple transformations like enriching a field to a message 2) PayloadFactory mediator - Somewhat advanced transformations. You can use this for changing the elements of an xml message and create a completely new message. This is the best option for your case 3) XSLT mediator - You can write XSLT tranformation code to transform the message. 4) XQuery mediator - You can write XQuery code to transform the message. Here is the documentation for ESB mediators. https://docs.wso2.com/display/ESB481/Mediators Thanks, Chanaka On Mon, Jan 5, 2015 at 3:39 AM, Maz Lakadia mlaka...@hotmail.com wrote: Hi, I would like to mediate a response from my server. This mediation would be changing something like: { Quote:{ Current:{ High:-61.53602401623976, Last:62.32682938796667 }, Code:WSO2, Price:62.32682938796667 }, Status:NOT-OK } into { Estimate:{ Now:{ Max:-61.53602401623976 }, Company_Name:WSO2, Worth:62.32682938796667 }, Status:Not Good } What I need is to change the name of some fields, delete others, possibly modify the values of some fields and add some fields. What mediator(s) would you suggest I use for such a task. Thanks, Maz ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- -- Chanaka Fernando Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 773337238 Blog : http://soatutorials.blogspot.com LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 Twitter:https://twitter.com/chanakaudaya Wordpress:http://chanakaudaya.wordpress.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Mediating a Server Response
You can use PayloadFactory with JSON payload as well. Script mediator is another option. You can use that as well. On Mon, Jan 5, 2015 at 7:39 AM, Maz Lakadia mlaka...@hotmail.com wrote: Thanks for your reply. My data is JSON format, does that change your opinion about what I should use? Also, is Script Mediator recommended for this task? -- Date: Mon, 5 Jan 2015 07:19:26 +0530 Subject: Re: [Dev] Mediating a Server Response From: chana...@wso2.com To: mlaka...@hotmail.com CC: dev@wso2.org Hi Maz, WSO2 ESB provides the following mediators which you can use to transform a message. 1) Enrich mediator - For simple transformations like enriching a field to a message 2) PayloadFactory mediator - Somewhat advanced transformations. You can use this for changing the elements of an xml message and create a completely new message. This is the best option for your case 3) XSLT mediator - You can write XSLT tranformation code to transform the message. 4) XQuery mediator - You can write XQuery code to transform the message. Here is the documentation for ESB mediators. https://docs.wso2.com/display/ESB481/Mediators Thanks, Chanaka On Mon, Jan 5, 2015 at 3:39 AM, Maz Lakadia mlaka...@hotmail.com wrote: Hi, I would like to mediate a response from my server. This mediation would be changing something like: { Quote:{ Current:{ High:-61.53602401623976, Last:62.32682938796667 }, Code:WSO2, Price:62.32682938796667 }, Status:NOT-OK } into { Estimate:{ Now:{ Max:-61.53602401623976 }, Company_Name:WSO2, Worth:62.32682938796667 }, Status:Not Good } What I need is to change the name of some fields, delete others, possibly modify the values of some fields and add some fields. What mediator(s) would you suggest I use for such a task. Thanks, Maz ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- -- Chanaka Fernando Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 773337238 Blog : http://soatutorials.blogspot.com LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 Twitter:https://twitter.com/chanakaudaya Wordpress:http://chanakaudaya.wordpress.com -- -- Chanaka Fernando Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 773337238 Blog : http://soatutorials.blogspot.com LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 Twitter:https://twitter.com/chanakaudaya Wordpress:http://chanakaudaya.wordpress.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Mediating a Server Response
Thanks for your reply. My data is JSON format, does that change your opinion about what I should use? Also, is Script Mediator recommended for this task?Date: Mon, 5 Jan 2015 07:19:26 +0530 Subject: Re: [Dev] Mediating a Server Response From: chana...@wso2.com To: mlaka...@hotmail.com CC: dev@wso2.org Hi Maz, WSO2 ESB provides the following mediators which you can use to transform a message. 1) Enrich mediator - For simple transformations like enriching a field to a message 2) PayloadFactory mediator - Somewhat advanced transformations. You can use this for changing the elements of an xml message and create a completely new message. This is the best option for your case 3) XSLT mediator - You can write XSLT tranformation code to transform the message. 4) XQuery mediator - You can write XQuery code to transform the message. Here is the documentation for ESB mediators. https://docs.wso2.com/display/ESB481/Mediators Thanks, Chanaka On Mon, Jan 5, 2015 at 3:39 AM, Maz Lakadia mlaka...@hotmail.com wrote: Hi, I would like to mediate a response from my server. This mediation would be changing something like: { Quote:{ Current:{ High:-61.53602401623976, Last:62.32682938796667 }, Code:WSO2, Price:62.32682938796667 }, Status:NOT-OK} into { Estimate:{ Now:{ Max:-61.53602401623976 }, Company_Name:WSO2, Worth:62.32682938796667 }, Status:Not Good} What I need is to change the name of some fields, delete others, possibly modify the values of some fields and add some fields. What mediator(s) would you suggest I use for such a task. Thanks, Maz ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- -- Chanaka Fernando Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 773337238 Blog : http://soatutorials.blogspot.com LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0Twitter:https://twitter.com/chanakaudayaWordpress:http://chanakaudaya.wordpress.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev