Hi,

I am trying to use Payload Factory Mediator to change server responses. Suppose 
I have 2 sorts of JSON objects my server can respond with: ball and bat. Now 
for the ball case, my response could look something like:
{"ball":    {"weight": 152},    {"radius": 46},    {"colour":"white"}}

If the case of "ball" I want to change the response to something like:
{"baseball":    {"colour":"white"},    {"mass":152},}
I know how to mediate a single resource like that. i.e. given the server 
response is "ball" object, I can change it to what I want. The difficulty 
arises if now I have a 2nd possible response from the server (a "bat" object). 
I wish to perform a similar mediation on it, but it would have different fields 
that need to be filled. Therefore my Payload Factory code from the "ball" case 
will no longer work. How could I write the configuration files such that for 
different resources ("bat","ball",etc) a different template is used to fill in 
the data? Is it easier to use a Script Mediator or some other sort of mediator 
for this purpose? 

Thanks,
Maz                                       
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to