How to use Translate Activity in SOA 12c – Native To XML

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
SOA-Translate-Activity
SOA-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
SOA-Translate-Activity Input String
SOA-Translate-Activity 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
SOA-Translate-Activity-Native-Builder-Format
SOA-Translate-Activity-Native-Builder-Format
  • 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
SOA-Translate-Activty-NAtive-Builder-Format-2
SOA-Translate-Activty-NAtive-Builder-Format-3
  • 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.
SOA-Translate-Activty-NAtive-Builder-Format-4
  • Define the target namespace for the schema
SOA-Translate-Activty-NAtive-Builder-Format-5
SOA-Translate-Activty-NAtive-Builder-Format-6

The Native Format builder wizard shows the Type for each column identified with the delimiter ( Commas )

SOA-Translate-Activty-NAtive-Builder-Format-7
  • Below given is the screenshot for the Native Schema File generated
Generated-XMLs
SOA-Translate-Activty-NAtive-Builder-Format-Finish

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

Translate-output-variable

Deploy the application