Tuesday, October 26, 2010

How to dynamically pass the file name and file path in file adapter "write" 10G and 11G


Lets see how to pass the directory location for the outgoing file in file adapter, for this we will proceed as follows.

Step 1. We will drop a new file adapter and configure it to use logical path, once we select logical path we need to configure the out directoy inside the bpel.xml file, the catch is we are setting the values of the property by using java embedding inside the BPEL process.

Step 2. This is how our bpel.xml file looks now.

We now use a java activity to dynimically set the path of the logical path inside the bpel.xml file

//dynamically set the property value inside bpel.xml file
try {
//get the location from the varible inside BPEL process
String location=(String)getVariableData("Variable_location");
// Update the bpel.xml file with value
// DemoFileWrite is name of bpel process, FileWrite is the name of the file adapter
getLocator().lookupProcess ("DemoFileWrite").getDescriptor().getPartnerLinkBindings()
.getPartnerLinkBinding ("FileWrite").setPropertyValue ("file_out",location);
catch(Throwable ex) {
//Log.logError("w_bpltph_errXMLCatchDetails","Failed file location creeeation",Log.ERROR_SEVERITY_FATAL,"","",fault_string);

If you are using SOA 11G this is very easy to do.
Just go inside the property tab when you double click on the Invoke activity, inside the property of Invoke there are different properties which you can set. Just click on the Values text space in front of the property it will take you to Adapter Property screen where you can browse the value for this property.


  1. Hello Yatan,

    I was trying to implement above using Jdev11.1.1.4..but looks like
    "getLocator().lookupProcess ("DemoFileWrite").getDescriptor().getPartnerLinkBindings()
    .getPartnerLinkBinding ("FileWrite").setPropertyValue ("file_out",location);"
    doesn't work in

    It gives following compilation error :
    [scac] symbol : method lookupProcess(java.lang.String)
    [scac] location: interface oracle.soa.management.facade.Locator
    [scac] Note: Some input files use unchecked or unsafe operations.
    [scac] Note: Recompile with -Xlint:unchecked for details.
    [scac] error: location {/ns:composite}: SCAC-50012

    any idea about this ???

  2. Hi',

    If you are using Jdev 11G then you can use the method I have given for 11G, I think you are using 10G method on 11G.


  3. Hi Yatan,
    In my project my requirement is to pass dynamic file pattern. How can i pass dynamic file pattern.

  4. Hi Vishnu,

    If you are doing a read operation, i.e. polling for a file then I am not aware of anyway through which we can dynamically pass the name of the file.


  5. you can assign variable to value in invoke property..

  6. yes Rajesh however that is possible in 11g not in 10G.

  7. Hi Yatan, You are doing a great job for giving such useful information to share for all of us.Thanks a lot.
    sap upgrade

  8. Your post is so nice. but you can also this as I always use long path tool for long path files. I Suggest everyone to try this.

  9. Hi yatan,
    Are you aware of any approach to dynamically specify the ArchiveLocation at runtime. There is a jca property PhysicalArchiveDirectory, but I don't see any bpelx:inputproperty to populate this at runtime.
    Please let me know if you have any information regarding the same.