I have json request, I need to convert this to XML, do some mapping of the parameters and then forward to API. Same way, for response from API, I need to map it, convert back to JSON and share to front end.
Apply JSON Transformation Assertion should be the one can help, please refer to,
Apply JSON Transformation Assertion - CA API Gateway - 9.1 - CA Technologies Documentation
Ok. I used Route via HTTP to get response from an API. I got response as XML. Let suppose we have a element <a> is response. Now, I need to have a xml with element<b> and value of element <b> should have same as <a> and add one more element c with hard code value as hello.
needs to be converted as
How to get element name change, map value from earlier element and add one more new element in xml.
We can add/delete element but how to get value mapped from earlier element?
Quick response is appreciable...
Also, when we add element in xml, how can we add value of that element. As, i added <c> but how to add value "hello"
TO get the value of existing element you would use evaluate xpath assertion to retrieve the element then use its output via the .result variable that gets defined and set that to new element.
To add new element with value include full xml element syntax such as <c>some value</c>
steba03 provided a good solution.
For more complicate mapping, you can use Apply XSL Transformation assertion, or Evaluate Regular Expression assertion.