Thursday, September 27, 2007

BPEL : How to read a file in middle of a process?

Question: How to read a file in middle of a BPEL process?

Answer: Following are the ways to read a file in mid of a BPEL process:

1. Using File Adapter: Avoid using the file adapter to read a file. The read file adapter is used to trigger the BPEL process in most cases. So in this scenario, the file adapter is not a good choice. Also it needs to use correlation sets to read files in the middle of a process.

2. Using Embedded Java code: It can solve the problem but it is not recommended and also it is hard to maintain.

3. Using built-in XPath function: The good way to read a file in the middle of a BPEL process is to use the built-in XPath function --> ora:readfile.

Example:

1. Drag an Assign activity in the swim lane at proper place

2. Create an Assign rule using the ora:readfile("file location", "xml schema path") XPath function

3. Assign the result to a variable.

6 comments:

Brainlara said...

Pretty neat explanation. Thanks, it really informative.

Amit said...

Not working Abhishek

Abhishek Saurabh said...

Hi Amit,

What is the commands you are wriying for calling the function.

Try using something like:
ora:readFile('file:///c:\temp\temp.txt')

Cheers,
Abhi...

Unknown said...

can you explain how sync read option works in file adapter.....

raghu said...

Hi Abhi,
I wrote the xpath function as u mentioned in the previous post.
But i am not getting the content of the file in the response.

Thanks,
Raghu

Anonymous said...

Hi,i am using jdev11.1.1.3.0 so i want to use syncread option to read the file in middle.bt i am not getting proper output.the file is read bt not write.so can u pls explain me...