I have flow that makes a request to soap service, and before the request I need to transform input json into xml:
I tried setting Qualified Name as dynamic property
%dw 2.0
output application/xml
ns ns0 http://tempuri.org/
---
{
("ns0#" ++ (vars.operation)): {
ns0#intA: payload.val1,
ns0#intB: payload.val2
}
}
but when i make postman request i get: Error consuming the operation [Divide], the request body is not a valid XML
I made it dynamic using if and else:
{
(
if (payload.operation == "Add") {
ns0#Add: {
ns0#intA: payload.val1,
ns0#intB: payload.val2
}
} else if (payload.operation == "Multiply") {
ns0#Multiply: {
ns0#intA: payload.val1,
ns0#intB: payload.val2
}
But I was hopping for more dynamic solution