Saturday 11 February 2017

FILE ADAPTER IN SOA

  Oracle BPEL PM and Mediator include the Oracle File and FTP Adapters. The Oracle File and FTP Adapters enable a BPEL process or a Mediator to exchange (read and write) files on local file systems and remote file systems (through use of the file transfer protocol (FTP)). The file contents can be both XML and non-XML data formats.

There are mainly 4 operations in FILE adpater namely:
  • READ: its an inboun operation that reads a file from given dir path
  • WRITE: outbound operation to write files to a location specified under directory path
  • SYNCHRONUS READ: outbound operation used to read a file in middle of the process
  • LIST FILE: outbound operation to list all the files in a given directory

How to use the FILE adapter in SOA 12c


Let us seen in detail about the steps in File Polling using FILE Adapter in SOA 12c.

1.Create SOA Project Named "FilePolling"


2.Drag and drop file adpater from component pallette to exposed services lane.





3.File adapter configuration window will pop up.Give the service name as "filePollService" and click next.



4.Leave adapter interface default and move next.

If the you have wsdl which will meets our requirement, then we can select using “Import an existing wsdl” else we need to select the “Define from operation and schema”




4.Give the JNDI name for the file Adapter.



5.Since we are reading for new records in a file.Choose operation type as "Read" and click next.Other setting leave as it is.


6.Enter directory path from where file adapter will poll for new files.If you want to delete files after successful read, check "Deletd files after successful retreival".Also, provide the location for archiving the file as well and move next.






7. Now in this part we will provide the name of the files that we want to read. I have given as "test*.*" which means it will read all the files starting with test.Leave other settings default and click next.





8.In this window we define polling frequency which means after how many seconds or minutes our file adapter will poll for new files.Also, if you want your file adapter not to read all the files as they are written on the server, use the minimum file age option.Click next.




9.We will be writing the file as it is read, so choose opaque schema option.



10.Click next and finish.




11.Drag and drop another file adapter this time to external references lane for writing file purposes.File configuration wizard will open up.




12.Give the Service name as "WriteFile".



13.Leave the adapter interface as default and choose next.






14.Give the JNDI name for the file adapter.





15.Click next again and choose operation name as "Write File" and click next.





16.Specify the directory path where you want your files to be written and file naming convention to be used for files written.If you want that each record is being written to existing file only use "Append to existing File" option. Otherwise leave it default and click next.







17.Select Opaque Schema and click next.Click Finish









18.Drag and drop the BPEL process onto  the components lane.





19.Choose BPEL process as define interface later and give "FileBPELProcess" name to your BPEL process.





20.Wire both file adapters to the BPEL





21.Double click the BPEL process and open up BPEL designer.In the BPEL designer drag and drop one Receive activity and wire it to the "readFile" partner link.





22.Window will pop up for configuring receive activity.As done in JMS adpater tutorial check mark "Create Instance" and create input variable by clicking on "+" icon.






23.Drag and drop invoke activity below receive activity and wire it to the "WriteFile" partner link.




24. Invoke window will pop up.In the same manner like we did for receive activity create input variable for invoke activity.





25.Drag and drop the assing activity between recieve and invoke activity.






26.Double click the assing activity and map receive activity input variable to invoke activity input variable means same contents are being copied to output.





27.Now you can deploy and test the process.







































No comments:

Post a Comment