5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 1/7
Oracle SOAThursday, June 3, 2010
Read XML file using Oracle BPEL file adapter.
Hi, This is my first blog and I am very excited about it.
From some last few months I am working on File adapter and wondering how complex is a file adapter. Also I feel the design of file
adapter is very strange, because the behavior of file adapter is very different from what we ever expect.
Here is a simple example of reading a XML file using file adapter. With file adapter we can either read or write a file,
The read operation can be either a "synchronous read" or "read",
In Synchronous read, inside an a BPEL process we can provide the file details and read a file,
In a ‘read operation’ we can poll a file from a directory.
Now we will see how we can read a file (poll) in windows environment
Sample files
Emp.xml
Note** for UNIX environment change target namespace
xsi:schemaLocation="http://www.example.org \home\file\XSD\emp.xsd"
Emp.xsd
Step1. Create a new empty BPEL project
Step2. Drop a file adapter from 'component pallet --> services' to ‘Services’ inside Jdeveloper window
Reading a XML file using File adapter in Oracle BPEL Yatan
Hyderabad, AP, India
I am a Senior SOA developer
working for an Indian IT
company in Hyderabad. I am responsible for
delivering Applications based on SOA
architecture using Oracle SOA Suite 11G/10G
and OSB. I hold a Masters in Computing from
Griffith College Dublin, Ireland.
View my complete profile
About Me
► 2011 (7)
▼ 2010 (2)
► October (1)
▼ June (1)
Reading a XML file using Fileadapter in Oracle BP...
Blog Archive
Share this on
Tweet this
View stats
(NEW) Appointment
gadget >>
Share it
Gwalior Fort
Amazon Contextual
Product Ads
Share 0 More Next Blog»
5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 2/7
Step3. Configure file adapter
(a) Name the file adapter which will becomes the service name.
(b) Select ‘read’ as operation type.
(c) Provide directory location for incoming file, here we can browse the location or can give the logical path name and can later
configure it inside the bpel.xml file.
(d) File filtering, this is wild pattern for a file name.
(e) Configure polling frequency and the age of file i.e. the time the file has been inside the directory.
Join this sitew ith Google Friend Connect
Members (5)
Already a member? Sign in
Followers
5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 3/7
(f) Provide the schema file (XSD), this is a very interesting configuration screen, as we can decide here weather we want to read a XML
file, opaque file or CSV file, etc
(g) Finish
Step4. Configure the receive activity to receive the contents from file adapter, remember selecting the create instance.
Step5. Finish
Step6. Deploy
5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 4/7
Step7. Test
Some interesting facts about file adapters
1.) If the XML file is incorrect then by default the file will get deleted and will move to
“Oracle_Home\bpel\domains\domain_name\jca\project_directory\rejectedMessages”, however we can move it to location of our
desire by configuring “failedMessageHandlers” property inside bpel.xml
2.) The file adapter does not verify the contents of the XML file with the schema mentioned in the file adapter (Step 3, f); what it does
by default is verify the contents of the XML with the schema mentioned inside the XML file’s target namespace.
Posted by Yatan at 12:00 PM
15 comments:
abhijat August 11, 2010 at 5:56 AM
Great stuff
Reply
Suman September 7, 2011 at 2:17 AM
Hi,
Article is really helpful.
I am beginner in this. Is it possible to provide some sample of xml(input) and xsd(schema) files ?
Thanks
Reply
Suman September 7, 2011 at 7:22 AM
Hey.
I am using Jdeveloper 11g. I followed the same steps but didn't get the output. Application deployment happens successfully
5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 5/7
but on server side UI didn't get any output.
Thanks,
Suman
Reply
Michael Gims September 12, 2011 at 8:34 AM
Great job, thanks, man!
Reply
Yatan September 12, 2011 at 10:47 PM
Hi Suman,
If no instance is getting created on UI(em comsole) then the XML file you are polling is invalid, i.e. its not valid according to
XSD.
Can you try using the same XML and XSD I have used, or create XML and XSD by using JDEV
Regards,
Yatan
Reply
AndySmith October 4, 2011 at 7:35 PM
Hi Yatan,
can we pass an xml instance file to the bpel process that has no namespaces declared. What I mean is that the structure of the
parent and child nodes is in accordance with the schema document but no declarations like
(xmlns="http://targetNamespace.com") are there. It is just a plain xml document that has no namespaces but whose structure
and name of tags matches that of the schema document.
Reply
Yatan October 5, 2011 at 2:49 AM
Hi Andy,
The file adapter will reject all such XML files which are without namespace.
Regards,
Yatan
Reply
SOA Technology for beginners and learners November 11, 2011 at 10:10 AM
hi good post yaar... but i am having an issue.. i am not able to insert into db the data wat i got... do you have end to end ,like
reading a xml file and then inserting into the db...
Reply
Yatan November 30, 2011 at 10:18 PM
Hi',
Thanks for comment.
If you want to insert data received from a XML file inside DB then you can do 2 things.
1.) Convert the data received from file into bit64Encoding and then passing that data in DB, you can make the data type of the
table column as blob type.
2.) Make the data type of DB table column as XML type and then pass the data received from the file into it.
Regards,
Yatan
Reply
SOA Technology for beginners and learners March 18, 2012 at 8:01 AM
hi yatan thanks i got .. it.. but i have question
i am having two tables header an line but and i am getting two xml from two file adapters.. can you please guide me how to
approach.
urgent yaar..
Reply
5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 6/7
Enter your comment...
Comment as: Google Account
Publish
Preview
Yatan March 18, 2012 at 10:21 PM
Sorry I didn't understood your requirement.
Reply
PK June 1, 2012 at 6:08 AM
Hi,
It is good & informative.
I am trying to read a CSV file and then write it to a new file using file adapter.
But the problem is that in the target file I am getting only commas without the actual content.
Please help.
Reply
James cavalino September 21, 2012 at 3:48 AM
Its a very informative site and what Yatan is doing quite commendable.Thanks for sharing such useful information with
us.Looking forward to more such articles.
sap upgrade planning
Reply
cheemala Thirupathiswami March 13, 2013 at 7:54 AM
hi one doubt how to read particuler data from xml using file adapters
Reply
Mithun Varma December 2, 2013 at 6:47 AM
Hello Yatan,
I have created an sample application for list of files using file adapter. Could you please help me how to pick the file as per
current date. Kindly do the needful
Regards,
Mithun
Reply
5/6/2014 Oracle SOA: Reading a XML file using File adapter in Oracle BPEL
http://yatanveersingh.blogspot.in/2010/06/reading-xml-file-using-file-adapter-in.html 7/7
Newer Post Home
Subscribe to: Post Comments (Atom)
Ethereal template. Template images by 4x6. Powered by Blogger.
Top Related