Wednesday, May 7, 2008

Insert New Line Character in BPEL Payload

Today my colleague has an interesting requirement. He need to interact with a legacy application which accepts input in CSV format. In the input first row should contain operation name, second row should contain all the column names and the next row is the data row. He was using Oracle BPEL to integrate legacy application with new application infrastructure. He was having data in a canonical business object and want to generate the required input CSV format.

The major challenge for him was to transform the business object into the input CSV which is having three rows. As he was a Java developer in the past, he tried using \n to insert new line character with no luck. Then he tried 
 which is the correct one to insert a new line character in an XML payload but when he executed the BPEL flow, 
 was inserted rather than the line break.

The trick to insert the new line character in XML payload from Oracle BPEL is to append 
 in the from expression of assign activity, then check your .bpel file it would have 
 rather than 
 because Jdeveloper replaces & with its equivalent escape character &. You need to replace & with & so it would become the correct new line character 
.