Tuesday, 6 January 2015

Setting Outbound Directory Dynamically in File Adapters - Oracle SOA Suite 11g


We often have a requirement of passing physical directory at run time so that it requires minimum code change in future.

I am listing down steps to do so in Oracle SOA Suite 11g.

In order to start with try to make a composite in order to write a file.

Once you complete your composite it will look something like this.





In this composite I  have configured File Adapter with write operation having physical path as /media/sf_SharedFolder/tempWriteFile

It's screenshot is as follows:



So when you try to open its JCA file as in my case its WriteFile_file.jca then it will look something like this.



The highlighted part in JCA file shows up Physical directory that we have mentioned while configuring write file adapter.

This is nothing but the target directory location where output file will be written, which we need to override by passing dynamic directory.

This is possible simply by setting up a Property as jca.file.Directory.



In order to do so go to your BPEL process and create a variable which is FileOutputDir of type Sting.

Assign value to this variable in assign activity which is /media/sf_SharedFolder/tempWriteFile/location  in my case.



Now we have to set this variable in jca.file.Directory property of invoke operation. 

So double click on invoke activity which open Edit Invoke activity go to its Properties tab and set jca.file.Directory property value as FileOutputDir and its Type should be input.

Apply changes and click on ok.



Save your composite and deploy it to your target server and test it.

Instead of writing file at  /media/sf_SharedFolder/tempWriteFile  your file will be written at /media/sf_SharedFolder/tempWriteFile/location 

jca.file.Directory property overwrites the default Physical Path to said Path.


No comments:

Post a Comment