Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

6
Am Pr Share 0 More Next Blog»

description

fault

Transcript of Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

Page 1: Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

5/6/2014 Oracle SOA: Fault handling in File adapter for CSV and XML files in SOA 11G

http://yatanveersingh.blogspot.in/2011/09/fault-handling-in-file-adapter-for-csv.html 1/6

Oracle SOATuesday, September 6, 2011

Hi All,

I will show how we can implement fault handling in file adapter when it is reading (polling) CSV files, I am using 1 1 G and using its Fault

Handling Framework.

This is a 2 step process,

1 .) In the first step process we hav e a composite which is polling for CSV file's, if the file is bad then it's using fault-policies to do the required fault

handling.

2.) The second step is creating a new composite which will exclusiv ely catch the error details from the first process and log it (I hav e skipped the

logging portion).

Step 1.) Create fault policies in composite which will poll for the .csv file.

This is how our composite looks.

This is the CSV file which I hav e used to configure the file adapter.

Employee.csv file

Name ID Age

y atan 1 01 29

y agy a 1 02 27

y ugansh 1 03 24

This is the XSD file which got created from the nativ e format builder of file adapter.

Employ ee.xsd (Created from Jdev file adapter nativ e format builder)

This is the contents inside the .jca file which shows the configuration details of this file adapter.

I hav e wired this File adapter with a BPEL process "ReadCSVBPEL". While creating this BPEL process I hav e giv en template as "Defile serv ice

later", inside the BPEL process I hav e used a receiv e activ ity to receiv e the data.

Fault handling in File adapter for CSV and XML files in SOA 11G 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)

▼ September (1)

Fault handling in File adapter forCSV and XML fil...

► August (1)

► July (1)

► June (2)

► May (1)

► April (1)

► 2010 (2)

Blog Archive

Share this on

Facebook

Tweet this

View stats

(NEW) Appointment

gadget >>

Share it

Gwalior Fort

Amazon Contextual

Product Ads

Share 0 More Next Blog»

Page 2: Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

5/6/2014 Oracle SOA: Fault handling in File adapter for CSV and XML files in SOA 11G

http://yatanveersingh.blogspot.in/2011/09/fault-handling-in-file-adapter-for-csv.html 2/6

This is the Configuration inside the receiv e activ ity

The most important part is Fault Handling here, if the .csv file we are polling for is a bad file, i.e. empty file or not schema compliant then we

should be notified about this.

The issue with file adapter is, if the file you are polling for is bad file it will simply rejected and the instance wont get created, this is not good as no one

would ever know what happened to the files and where are they going.

I will show here fault-policies.xml and fault-bindings.xml

fault-bindings.xml

There are 2 places highlighted in red.

1 .) name="rjm:ReadCSV", where is this coming from, This is the end point of the serv ice, in the Oracle Dev eloper Guide its little confusing as they

hav e written here , the serv ice end point is file adapter name here.

2.) This is actually the details of the composite which is exclusively doing the fault handling for file adapters. I will again describe this is

detail.

Next file is fault-bindings.xml.

fault-bindings.xml

Now inside this file there are again 2 v alue highlighted in red, where is this v alue coming from,

1 .) faultPolicy ="RejectedMessages", this is v alue for our fault-policy id.

2.) ReadCSV, this is end point for the serv ice.

Step 2.) We hav e design a new composite which will be used for catching the faults thrown by other composite which we hav e designed in Step 1 .

The input for this serv ice will be this ty pe,

RejectedMessages.xsd

Join this sitew ith Google Friend Connect

Members (5)

Already a member? Sign in

Followers

Page 3: Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

5/6/2014 Oracle SOA: Fault handling in File adapter for CSV and XML files in SOA 11G

http://yatanveersingh.blogspot.in/2011/09/fault-handling-in-file-adapter-for-csv.html 3/6

You can skip the below 5 steps by simply using this file.

1 .) Create a new composite "FileFaultHandling" and put RejectedMessages.xsd after that drop a web serv ice adapter to the exposed serv ice area

name it "RejectedMessageServ ice" and on the WSDL URL use "Generate WSDL from Schema".

2 .) Configure the WSDL file use the same namespace as used in RejectedMessages.xsd after that click on Add a new message part

3 .) Use RejectedMessage as URL.

Page 4: Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

5/6/2014 Oracle SOA: Fault handling in File adapter for CSV and XML files in SOA 11G

http://yatanveersingh.blogspot.in/2011/09/fault-handling-in-file-adapter-for-csv.html 4/6

4.)

5.)

6.) Drop a new BPEL process with template as "Define serv ice later", and wire the RejectedMessageServ ice web serv ice adapter with this BPEL

process.

7 .) Inside the BPEL process use a receiv e activ ity and configure it with the RejectedMessage serv ice.

8.) Deploy the serv ice and go to the EM to get its URL.

I told that I will describe in details about a URL in fault-policies.xml

inside fault-policies.xml.

This is the format

format - Absolute WSDL|service name|port name

WSDL of the FileFaultHandling serv ice

Serv ice name (This is the end point of this serv ice)

portname (this is the port name of that serv ice again)

Deploy 1 st serv ice and test.

I will keep "TestCSVFile2.csv " file at this location "C:\Files\CSVRead" and will simply write some junk data inside it, example aaaa, as this is not

schema compliant it will get rejected and will call our FileFaultHandling serv ice and will pass the data there.

Page 5: Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

5/6/2014 Oracle SOA: Fault handling in File adapter for CSV and XML files in SOA 11G

http://yatanveersingh.blogspot.in/2011/09/fault-handling-in-file-adapter-for-csv.html 5/6

Remember, this rejection message handler will not do complete fault handling, this is only going to reject empty files, files with some

junk data or incorrect data on first line.

If we were reading a XML file then the file adapter will reject any file which is not schema compliant, the XML file will be thoroughly

checked, however this is not in the case of CSV files where only empty/junk data files will be rejected, all the non schema compliant

csv files will not be rejected by file adapter,so we have to do more work for fault handling when we are dealing with CSV files.

Posted by Yatan at 11:29 PM

Enter your comment...

Comment as: Google Account

Publish

Preview

3 comments:

arun April 13, 2012 at 10:48 AM

Where can I find the RejectedMessages.xsd and RejectionMessage.wsdl in soa suite 11g?

Reply

Izaak de Hullu May 2, 2012 at 8:27 AM

What version do you use? I tried this in 11.1.1.4.0 but invokeWS is not supported here :-(

Reply

Mike November 23, 2012 at 6:37 AM

Your blog is really helpful for the beginner in oracle SOA. I am also new to SOA 11g.Very well written post. Keep posting like

this. Thanks!

digital signatures

Reply

Page 6: Oracle SOA_ Fault Handling in File Adapter for CSV and XML Files in SOA 11G

5/6/2014 Oracle SOA: Fault handling in File adapter for CSV and XML files in SOA 11G

http://yatanveersingh.blogspot.in/2011/09/fault-handling-in-file-adapter-for-csv.html 6/6

Older PostHome

Subscribe to: Post Comments (Atom)

Ethereal template. Template images by 4x6. Powered by Blogger.