Tuesday, October 26, 2010

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

Hello,

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.