OIC/Integration/6 → REST Connection with FTP to split file into multiple files in Oracle Integration Cloud

integratio
6 min readAug 27, 2023

--

This is a post on Oracle Integration Cloud highlighting an integration exposed as a REST service that reads FTP file and split it to multiple files, writing in FTP file path.

Integration

(1) Flow: [a] Receive -> [b] Map to Read Ftp file -> [c] Read Ftp file -> [d] Assign to tempVar -> [d.1] Map to Stage Write -> [d.2] Stage Write -> [d.3] Stage Read -> [e] Assign to Variable -> [f] While loop -> [f.1] Map to Write file -> [f.2] Write file -> [f.3] Update counter -> [g] Map to Reply -> [h] Reply

(2) Flow Description: Here we are creating an App Driven Orchestration flow exposing via REST which when invoked, reads csv file from FTP location, loops over the records and split the payload across multiple xml files based on a unique field value in source data and finally write to target FTP location.

(3) Steps:

Go to OIC console → Integrations → Create an App Driven Integration with your project name.

[a] Receive:

Use the following schema: “REST_Schema.xsd”

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.test.com"
targetNamespace="http://www.test.com"
elementFormDefault="qualified">
<xsd:element name="REST_Req">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Param_1" type="xsd:string"/>
<xsd:element name="Param_2" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="REST_Resp">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Response" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

[c] Read Ftp file:

Create a csv file : “ftpFileRead.csv” as below:

OrderId,OrderName
101,"Order_01"
102,"Order_02"
103,"Order_01"
104,"Order_03"
105,"Order_02"
106,"Order_01"
107,"Order_03"
108,"Order_02"
109,"Order_01"

[b] Map to Read Ftp file:

[d] Assign to tempVar:

[d.2] Stage Write:

Use the below XSD : “SingleString.xsd”

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.singleString.com"
targetNamespace="http://www.singleString.com"
elementFormDefault="qualified">
<xsd:element name="SingleString">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SingleStringItem" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Flow:

[d.1] Map to Stage Write:

Use distinct values function to find unique OrderName.

Here we are grouping based on OrderName as below:

So, 3 unique sets will get generate and based on the OrderName loop , we will write 3 separate files. So, each file for a unique OrderName will have details of multiple OrderIds.

Flow:

[d.3] Stage Read:

[f] While loop (we will add in later step and put other activities mentioned below inside the loop activity)

[f.2] Write file:

Use the below XSD : “Order.xsd”

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.test.org"
targetNamespace="http://www.test.org"
elementFormDefault="qualified">
<xsd:element name="Order">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="OrderItem" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Id" type="xsd:string"/>
<xsd:element name="Name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Flow till now:

[f] While loop:

Use Reposition to move activities inside the loop activity as below:

[e] Assign to Variable:

Here we are creating 2 variables to populate the Unique Order Names.

[f] While loop (updating):

[f.3] Update counter:

[f.1] Map to Write file:

Test the flow:

Output XMLs:

………………………………………………………………………………………………

--

--

integratio

📌 IT Backend enthusiast 📌 Blogging about Oracle FMW, Python, Cloud related technologies 📌 Non monetized, non hustle 📌 Knowledge sharing sole purpose