SOA 12c - FTP Adapter (Get File)
Information that you need to know:
In the inbound direction, The Oracle FTP Adapter works the same way as the Read File operations of the Oracle File Adapter in that it polls and gets files from a file system for processing. The major difference is that the Oracle FTP Adapter is used for remote file exchanges. To configure the FTP adapter for remote file exchanges, the Adapter Configuration Wizard asks for connection information to an FTP server to be used later. For more detailed information read the following URL: https://docs.oracle.com/html/E10231_03/adptr_file.htm#CIABDJEF
In this post, we will learn how create a SOA Project with FTP Adapter - Operation Type: Get File (inbound 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 | GetFile |
| Directory | C:\JDeveloper\mywork\FTPAdapter\GetFile |
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 Exposed Services section right click > Insert > FTP, then enter the ftpService 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 Get File 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 File Polling, put 5 minutes as Polling Frequency and 0 as Minimum File Age, then click on next button.
For Example:Then on Message, click on Define Schema for Native Format.
For Example:Once the Native Format Builder window is displayed we have 8 steps to generate our XSD.
Then on File Name and Directory, set the next values, and click on next button.
| File Name | nxsd_schema1.xsd |
| Directory Name | C:\JDeveloper\mywork\FTPAdapter\GetFile\SOA\Schemas |
Then on Choose Type, select Delimited such as Select file type.
| Select file type | Delimited (Contains records whose fileds are delimited by a scpecial character) |
Then on File Description, we need specify name of the file that you want to sample. So, we need do click on Browse button and then select its respective file.
In our case we are going to change the value of Character set by UTF-8, then click on next button.
Note: We will leave the rest of the values as they are by default.
Then on Record Organization, we are going to select File contains multiple record instances, then select Multiple records are of single type.
Click on next button.
Then on Specify Elements, we are going to fill the target namespace and the element names.
For the Target namespace we are going to put http://TargetNamespace.com/ftpService, this value is pupulated by default.
By default the name of the element containing multiple records are Root-Element we are going to maintain the same value.
We are going to put employee such as name for element that will represent record.
Click on next button.
Then on Specify Delimiters, we are goint to select End of Line($eol) such as records delimiter and select Comma (,) such as fields delimiter, and the rest of the values will be kept by default.
Note: The delimiter depends of your delimiter file, in our case we have "," such as delimiter.
Click on next button.
Then on Field Properties, we are going to specify the field names and field properties.
We are going to check "use the first record as the field names", then click on next button.
In the current window we are going to view our generated native format schema.
We are going to do click on Test button just to validate if all the previously steps are success.
Then on Finish, click on finish button.
Then, returning to the Message step, we are going to select our xsd generated and the Root-Element such as Schema Element, then click on next and click on finish.
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 | BPELProcessGetFile |
| Namespace | http://xmlns.oracle.com/FTPAdapter/GetFile/BPELProcessGetFile |
| Directory | C:\JDeveloper\mywork\FTPAdapter\GetFile\SOA\BPEL |
| Template Type | No Service |
| Template | Define Service Later |
For example:
Now we need drag to add a new Service, with this action we will have available the Partner Links on .bpel file.
In Set the Transaction Properties of BPEL Service.
Select sync as Delivery and required as Transaction, then click on ok button.
Now we are going to do double click on component: BPELProcessGetFile, then on BPELProcessGetFile.bpel file, we need to select the Receive activity and drag to work area, then change the name to ReceiveFtpService
For example:Then we need to drag onto a Partner Link to make a Web Service connection. On the Edit Rceive window, set the next values, and click on ok button.
| Variable | GetInput |
| Type | {http://xmlns.oracle.com/FTPAdapter/ListFiles/BPELProcessListFiles}BPELProcessListFilesRequestMessage |
For example:
Then click on Apply button, next click on Ok button,then click on Save All button.
Until this part of this exercise we already covered the Get File operation from the FTP Adapter Service, if you run the service you should be able to see a successful reading of the files, but at this point we can do whatever you want, in my case it will insert the records into a custom table.
I created a external service to perform inserts in my custom table.
I created a transform to map between my file and my table.
For more information about how create a Database Adapter Reference please open the following links:
DB Adapter (Execute Pure SQL)
DB Adapter (Perform an Operation on a Table)
DB Adapter (Call a Stored Procedure or Function)
DB Adapter (Poll for New or Changed Records in a Table)
Now the next step is create a jar file to can deploy it on WebLogic Server, we need to select the GetFile project and righ click, then chose the GetFile... 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
Post a Comment