Oracle SOA 12c provides new feature “Translate Activity” which can be used to convert any native format file like CSV to XML and vice versa. The blog provides the steps to translate the Native Format File to XML File.
Translate Native Format File to XML File
Consider 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 provides 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
- 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. Translate Activity provides below options ( Native to XML and 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
- Convert the Schema to Native (delimited string) to XML format. We can use either of the given below options
- Option 1 – Provide the available schema OR
- Option 2- Generate the schema using the Native format builder wizard
- Click Option 2 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.
- 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