How to use CDATA in PI
The business requirement was to encapsulate a grid structure in a string using CDATA tag, i.e., <Business Data>]>.
Adding CDATA tag was easy using XSLT mapping and it was tested successfully using SoapUI tool. But once tested with the vendor application, the CDATA tag was missing from the received payload even though the outbound payload in PI message log was having the desired structure with proper CDATA tag.
Vendor was looking for a string created with the payload and encapsulated within CDATA tag. Using XSLT only added the tag, but it was not able to send the output in a string format.
The objective was achieved using 2 message mappings and one generic XSLT mapping.
The 1st Message Mapping was used to convert the incoming payload from ECC into vendor structure.
The 2nd Message Mapping was used to add CDATA tags & move the entire converted payload into a string. (here in the WhereUsed field)
Then applied a generic XSLT mapping so that PI bypass the CDATA tag while sending data to the vendor.
Final Operation Mapping for the response would look like below:
Here is a sample response payload from ECC: