This is a common scenario where XML message can contain delimited / fixed length string and to overcome such issues, SOA 11g provided the File / FTP Adapter as the mechanism but there was no specific activity available to confirm the XML messages to Native Format or from Native Format to XML message from the received input.
SOA 12 c, provided Translate Activity as the solution for such transactional data. Steps are similar to what we use in the File /FTP Adapter
Let’s go through the sample given below to see how to convert XML messages to Native Format or from Native Format to XML message using the Translate Activity
1. Create the SOA Application for the Translate Activity
Drag the Translate Activity from Oracle Extensions to the BPEL Process
Double Click the Translate Activity to get the translation tab. It provides 2 options
• Native to XML
• XML to Native
Select the option as Native to XML and click on the Search Icon corresponding to the Input parameter. The below given is the Input Variable Payload Input String
Now, we need to have the schema to convert Native (delimited string) to XML format. We can use either of the given below options
• Provide the available schema OR
• Generate the schema using the Native format builder wizard
Click the 2nd Icon for the NXSD schema to generate the Native schema
Select the option as Delimited. Specify the file with the Native format which includes delimited records. I have selected EMP.txt file with sample employee records delimited with commas
The next steps identifies the number of records present in the file ( whether there is single record or it could be multiple record file), whether it contains single type data or different type data.
Thereafter , define the target namespace for the schema.
The Native Format builder wizard shows the Type for each column identified with the delimiter ( Commas )
Below given is the screenshot for the Native Schema File generated
The Translate activity includes Input and Output Variable. The Input variable was intialized, now the schema has been generated. Create the Output Variable by clicking the GREEN + icon
Deploy the application