Friday, June 27, 2014

Many people wonder why there is no option for file listing in Oracle Service Bus and this is something mostly used when we needs to read multiple files in loop. This post will explain how we list files in OSB.

OSB has file protocol which we can use to read the file but we don’t see any option available to list files. In SOA when we use file/ftp adapter and there we have file listing option which we can use to list the files and this option is not available in OSB with default file protocol.

Trick here is that we will use same SOA file/ftp adapter in OSB to list the files. we will perform below steps to do file listing.
  • Create file/ftp adapter in Jdeveloper and choose file list option
  • Import adapter JCA & WSDL file to OSB project
  • Generate business service from adapter JCA file

Let’s see how this works.

First open your Jdeveloper, create a SOA composite. Drag file adapter if you need to list files from local system or drag ftp adapter if you need to list files from remote server.

Name your adapter and choose “List Files” option. Provide Physical path, file name and save the adapter.

You will see one JCA and one WSDL file created, you need to import both the files to OSB project.

Before that you need create one OSB project in eclipse.

Right-click on JCA file and go to “Oracle Service Bus” à”Generate Service”, then choose the folder where we want to create the business service.

Once you complete the above step, you will see one business service file and one wsdl file in that folder.

Now deploy your OSB project to OSB server and test it.

Testing Result:

To test it place couple of files in required location and test your business service. You should see list of all the files.

By Vivek Garg - 6/27/2014

Please do not copy content of this post.


Post a Comment