SOA 12c - FTP Adapter (List Files)

Here we go!
Information that you need to know:

The Oracle FTP Adapter polls for files in a target directory and lists files from the target directory to specified FTP locations. The contents of the files are not read. This feature of the Oracle FTP Adapter lets you use an invoke activity to retrieve a list of files from a target directory. This list of files is returned as an XML document and contains information such as file name, directory name, file size, and last modified time.

For listing files, you must select the List Files operation from the Operation Type page of the Adapter Configuration Wizard. In the File Directories page of the Adapter Configuration Wizard, you must specify information about the directory to use for reading file names for the list operation. You can choose to list files recursively within directories. The File Filtering page of the Adapter Configuration Wizard enables you to specify details of the files to retrieve or ignore. For more detailed information read the following URL: https://docs.oracle.com/html/E10231_03/adptr_file.htm#BABEDEGC

In this post, we will learn how create a SOA Project with FTP Adapter - Operation Type: List Files (outbound operation).

The next images are the SOA Project execution:

Now we are going to open JDeveloper IDE and click on File menu > New > Application.

For example:


On the Application window, set the next values, and click on next button.
Application Name FTPAdapter
Directory C:\JDeveloper\mywork\FTPAdapter
Application Package Prefix

For example:


On the Project window, set the next values, and click on next button.
Project Name  ListFiles
Directory C:\JDeveloper\mywork\FTPAdapter\ListFiles

For example:


On the Configure SOA settings window, set the next values, and click on finish button.
Standard Composite  Empty Composite

For example:


After clicking on finish button, the JDeveloper IDE has the next appearance:

Then the next step, on External References section right click > Insert > FTP, then enter the ftpReference value on FTP Name, then click on next button.

For Example:

Then on Adapter Interface click on next button.

Then on FTP Server Connection put your value, in this practice we already created a FTP Server Connection on Weblogic: eis/Ftp/FtpAdapter click on next button.

Then on Operation select Ascii as a File Type and List Files as a Operation type, click on next button.

Then on File Directories, put the directory for incoming files, then click on next button.

Then on File Filtering, select File Wildcards as a Name Patterns and iscfgg*.txt, as a Include Files with Name Pattern, then click on next button.

For Example:

Then on Finish, click on finish button.

For Example:

Then the next step, we need to select the BPEL Process component, this component is located on the right side, on Components section, when you found this, select it and drag it to Components section on work area.

For Example:

On the Create BPEL Process window, set the next values, and click on ok button.

BPEL Specification BPEL 2.0 Specification
Name BPELProcessListFiles
Namespace http://xmlns.oracle.com/FTPAdapter/ListFiles/BPELProcessListFiles
Directory C:\JDeveloper\mywork\FTPAdapter\ListFiles\SOA\BPEL
Template Type WebService
Template Asynchronous BPEL Process
Service Name bpelprocesslistfiles_client
Expose as a SOAP Service  Checked
Delivery async.persist
Transaction async.persist
Input {http://xmlns.oracle.com/FTPAdapter/ListFiles/BPELProcessListFiles}process
Output {http://xmlns.oracle.com/FTPAdapter/ListFiles/BPELProcessListFiles}processResponse

For example:

Now we need drag to add a new Reference, with this action we will have available the Partner Links on .bpel file.

For example:

Now we are going to do double click on component: BPELProcessListFiles, then on BPELProcessListFiles.bpel file, we need to select the Invoke activity and drag to work area, just in middle of receiveInput and callbackClient and change the name from Invoke1 to InvokeFtpReference

For example:

Then we need to drag onto a Partner Link to make a Web Service connection. On the Edit Invoke window, set the next values, and click on ok button.

Input Variable ftpReference_Input
Type {http://xmlns.oracle.com/pcbpel/adapter/ftp/FTPAdapter/ListFiles/ftpReference}Empty_msg
Output Variable  ftpReference_Output
Type {http://xmlns.oracle.com/pcbpel/adapter/ftp/FTPAdapter/ListFiles/ftpReference}FileListing_msg

For example:

Then click on Apply button, next click on Ok button,then click on Save All button.

We need to drag the Assign activity to work area between InvokeFtpReference and callbackClient components.

For example:

Then change the activity assign name from Assign1 to AssignCallbackClient.

For example:


Now we need to double click on AssignCallbackClient activity.

On the Edit Assign window, set the next values, and click on Ok button.

$outputVariable.payload/client:result  count($ftpReference_Output.filelist/ns1:file/ns1:filename)

For example:
Note: Basically on previous image we use the count function just to get the number of the listed files and then assign this the value to response variable.

Now the next step is create a jar file to can deploy it on WebLogic Server, we need to select the ListFiles project and righ click, then chose the ListFiles... option.

For example:


On the Deployment Action window, set the next values, and click on next button.
Deployment Action  Generate SAR File

For example:


On the Deployment Configuration window, set the next values, and click on next button.
New Revision ID  1.0

For example:


On the Deployment Summary window, click on Finish button.
For example:


If all steps were successful, then you will view on yours JDeveloper IDE the correctly deployment.
For example:

Comments

Popular posts from this blog

SOA 12c - Fault Handling (Creating Fault Policies and Fault Bindings)

SOA 12c - DB Adapter (Perform an Operation on a Table)