Read XML file using Oracle ICS / OIC FTP adapter
This article will show you another capability of Oracle ICS / OIC FTP adapter to Read XML files. After this article, you will be learned how to parse XML files which reside FTP location.
Important Blogs to learn more about Oracle ICS / OIC
In the previous article we have showcased how to create FTP adapter.
In the example, an ICS scheduled will be developed which will read an XML file from SFTP location and logs the data in logs file.
Below is the sample file which we’ll use to read
<?xml version=”1.0″ encoding=”UTF-8″?>
<Emp>
<name>Ankur</name>
<id>Emp-2018</id>
</Emp>
Let’s have a look how to achieve the use case step by step
- Create an FTP connection. Please go through the article to see how to create FTP connection
- Create a Scheduler integration. Have a look on how to create Scheduled integration
- Drop the FTP adapter on Integration canvas and go through the wizard
- Enter the Endpoint name as per your choice and Click Next button
- Enter below information and click Next
- Select Operation: Read File
- Select a Transfer Mode: ASCII
- Enter Input Directory: Enter the directory name to pick up the file for example: /root/integration)
- Enter File Name: Enter the file name to read for example:temp.xml
- Select Below information and Click Next
- Do you want to define a schema for this endpoint: Yes
- Do you want to create a new schema or select an existing one?: Select an existing schema from the file system
- Save the content in a file (Abc.xsd) and Select the XSD file
<xs:schema attributeFormDefault=”unqualified” elementFormDefault=”qualified” xmlns:xs=”http://www.w3.org/2001/XMLSchema”>
<xs:element name=”Emp”>
<xs:complexType>
<xs:sequence>
<xs:element type=”xs:string” name=”name”/>
<xs:element type=”xs:string” name=”id”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
- Click Done in the last screen
- Drop a Logger activity just below the FTP adapter and add below expression:
concat(‘ Name is ‘, $ReadXMLFile/nssrcmpr:SyncReadFileResponse/nsmpr1:FileReadResponse/nsmpr3:Emp/nsmpr3:name,’ Id is ‘, $ReadXMLFile/nssrcmpr:SyncReadFileResponse/nsmpr1:FileReadResponse/nsmpr3:Emp/nsmpr3:id)
- Now Save the integration and Run
- Check the Integration instance and notice that name and id has been printed in the logger
What if I need to give wildcard name to file.
Awesome and interesting article. Great things you've always shared with us. Thanks. Just continue composing this kind of post. compress jpeg to 50kb
I am getting translation exception.Can you please let me know what I need to do
I'm translation error, please help
can read read source file as xls and target json format , si it possible ?