Polling Operation using File Adapter in SOA Suite 12c

Introduction:

File Adapter is integrated with SOA suite 12C to make the way easy to handle all the file based transaction. You can do operations on files in pretty easy way like reading files, write on files, synchronous read file. However, processing of files can be done on demand basis or polling basis.

In this example, we will see polling operation of file adapter and the data in the file will be inserted into database table.

Implementation of SOA application:

  1. First step is to create a SOA project. Right click on application -> New -> Project. Select SOA project and Enter project name a�?FileAdapterPollingPrja��File_Polling_1 File_Polling_2 File_Polling_3
  2. Click on a�?Nexta�� and select composite type as a�?Composite With Mediatora��File_Polling_4
  3. Click on a�?Finisha�� and a�?Create Mediatora�� wizard will open.File_Polling_5
  4. The composite will look like this.File_Polling_6
  5. Now drag a�?File Adaptera�� in the a�?Exposed Servicesa�� swim lane and a�?File Adapter Servicea�� window will open.
  6. Enter service name and click on a�?Nexta��File_Polling_7
  7. Select Adapter Interface a�?Define from operation and schemaa�� and click on a�?Nexta��.File_Polling_8
  8. Select JNDI name of file Server to access the file server at runtime.File_Polling_9
  9. Select Operation type as a�?Read Filea��File_Polling_10
  10. Give physical path of the incoming file and select other options as shown in the below screenshot.File_Polling_11
  11. Enter the pattern of the file name and click on a�?Nexta��. SOA application will select only those files from directory whose name starts with a�?empa��.File_Polling_12
  12. Click on a�?Nexta�� and Change the polling frequency as per the requirement.File_Polling_13
  13. Schema element is required for file operation. Click on a�?Nexta�� and then select the cog icon beside the URL field.File_Polling_14
  14. Enter the file name of the schema and click on a�?Nexta��.File_Polling_15
  15. Select file typeFile_Polling_16
  16. Browse the sample file for creating schemaFile_Polling_17
  17. Select the option ‘File contains multiple records’ and ‘Multiple records are of single type’File_Polling_18
  18. Click on a�?Nexta�� and accept the default options. Finally the below window will come with the XSD.File_Polling_19
  19. Click on a�?Nexta�� and will navigate back to the schema definition windowFile_Polling_20
  20. Now the composite will look like this.File_Polling_21
  21. Drag DB Adapter in the a�?External Referencesa�� swim line and Database Adapter Configuration wizard will open.File_Polling_22
  22. Give Database connection details and JNDI connection details.File_Polling_23
  23. Select operation type as a�?Insert Onlya�� for Database Adapter.File_Polling_24
  24. Click on a�?Nexta�� and select the table from schema.File_Polling_25
  25. Select primary key column in the selected table.File_Polling_26
  26. Now select the columns where data will be inserted from file.File_Polling_27
  27. Click on a�?Nexta�� and select any sequence (depends on requirement) against the primary key column.File_Polling_28
  28. Click on a�?Nexta�� and select the default optionsFile_Polling_29
  29. Click on a�?Finisha�� and now the composite will look like below screenshotFile_Polling_30
  30. Double click on mediator and click on the icon File_Polling_31A�in the transformation option. This will help to create XSLT mapping between the input file and database table.File_Polling_32
  31. Enter XSLT file nameFile_Polling_33 File_Polling_34
  32. Click on a�?OKa�� and mapping file will open. Drag and drop a�?for-eacha�� operation in the target lane and do the mapping between source and target.File_Polling_35
  33. Polling operation is done. Now deploy the project in the server. For deployment you can refer my HelloWorld Mediator service.
  34. Keep one file in the input directory and see in a fraction of a second file will be polled by the SOA application and data will be inserted in the table. Check the table in database.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here