I got a response from endpoint in WSO2 enterprise Integrator as a XML. I can get it as a Json too. but I need to make suitable response (add more parameters) for my client application. this is the xml response i got from endpoint.
<jsonObject>
<ddd>
<__type>Title</__type>
<AccountNo/>
<AccountExists>1</AccountExists>
<Name>user name</ConsumerName>
<Address> user address</ConsumerAddress>
<TotalDue>1000.38</TotalDue>
<LastBillingCycleAmount/>
<ID>150</ID>
</d>
and also this is the json output i can retrieve from endpoint
{
"ddd": {
"__type": "Title",
"AccountNo": null,
"AccountExists": 1,
"Name": "user name",
"Address": "address",
"TotalDue": "1000.38",
"LastBillingCycleAmount": null,
"ID": 150
}
}
I need transform response like this.
{
"AccountNo": "response_data",
"ConsumerName": "response_data",
"ConsumerAddress": "response_data",
"TotalDue": "response_data",
"additional_para1": "my_data", // parameter that i want to add manually
"additional_para2": "my_data", // parameter that i want to add manually
}
You can use a data mapper mediator [1] to map the input to the desired output. Then use a enrich mediator [2] to enrich the generated payload by adding your own values
[1]-https://ei.docs.wso2.com/en/7.1.0/micro-integrator/references/mediators/data-Mapper-Mediator/
[2]-https://docs.wso2.com/display/EI620/Enrich+Mediator