Preface – This post is part of “WebSphere Cast Iron Cloud Integration with Salesforce.com” series.

Today I will post how you can use WebSphere Cast Iron for integrating FTP with Salesforce. Toady, in this example, I will fetch a CSV file present in a FTP server, read that file and then create the Salesforce object based on that record. Finally I will send the response also. So let’s not waste time here and get straight into the business.

Use Case:
Below is the object structure –

Below is the CSV File(All_Airports.csv) I would like to read and load from FTP server.

Once done, the final requirement is to create Salesforce records based on the data present in the CSV file.

Implementation:
Before we start implementing the above requirement, let’s create the Endpoints first.
Endpoint – FTP:

Endpoint – Salesforce:

Endpoint – HTTP:
Create a default HTTP endpoint with port number 80.

Now we will create the Flat File Schema as shown below. This flat file schema will be used to read to CSV file present in the FTP server.


So all set. Now we will configure the integration by putting activities inside the Orchestration.

Activity# 1: HTTP Receive Request:
Below you will find all the configuration details related to Receive Request activity.

Activity# 2: FTP Get File: 
This activity will fetch the CSV file from the FTP Server. The configuration of this activity is displayed below –

Activity# 3: Transform Read Flat File:
Activity# 4: Salesforce.com Create Objects:
In this activity we will create Salesforce records for the custom object Aiport__c based on the data from the previous activity. Below are the details of the configuration.
Activity# 5: Write XML:
Below are the configuration details for this step.
Activity# 6: HTTP Send Response:

This is the last activity and in this one, we will send the response back. Below are the configuration details

We are done. The final Orchestration looks like –


Test the Integration –
It’s time to test the configuration. First we need to start the orchestration and we can do that from Orchestration | Start Orchestration.
Then let’s call the HTTP post method as displayed below –

I have used a Chrome Extension named DHC for my testing. 
You can do HTTP POST by clicking on Tools | HTTP Post Utility.
Below is the response I am getting back –

In Salesforce also, records are created.


GREAT!!!
If you follow the steps mentioned earlier, you will be able to configure the integration very easily. Please let me know if you need any details. Thanks.