Friday, May 2, 2014

We usually do file polling from local or remote system using File and FTP adapter. We poll either XML or flat files, File and FTP adapter generate XSD (Schema) for flat file and use already existing schema for XML file. If the file comes in required format or structure then adapter will pick the file and read its content as expected but what happen when file didn’t come in expected format.

As you notice when we poll the file and file is corrupt i.e. not in correct format then we don’t see any instance in em console and file got deleted so we never come to know that what went wrong with file as there is no instance on em console.

Solution to above problem is error handling. We have two types of error handling for file and ftp adapter.

  • In-Build error handling
  • Custom error handling using Fault Handling Framework
By default adapter has in-build error handling that will put the message to rejected folder if file which it try to read is corrupt i.e. not in correct format.

In this post, I will show you how in-build error handling works for file and ftp adapter.

I have created one sample composite which poll the file from local system so we are using file adapter to poll that file. File that we are going to use here is XML.

Below is the configuration for file adapter.



When the file is correct then we see file got deleted from the folder and new instance in em console.




But when the file is not in correct format then we see that file got deleted from folder but no instance created on em console.



In above case adapter will move that corrupted file to rejected messages folder.

Rejected Messages folder path: C:\Oracle\Middleware\user_projects\domains\base_domain\rejmsgs



This is how In-build error handling works in file adapter.


Download sample code from here.



Next post explain about next error handler, File Rejection Handler - File error handler for File Adapter.



11 comments :

  1. Hello.. Thanks for this post.... Can u advice what will be the behaviou in case of FTP adapter. will file be moved to same location "Rejected Messages folder path: C:\Oracle\Middleware\user_projects\domains\base_domain\rejmsgs"

    ReplyDelete
    Replies
    1. Yes, same behavior we see for FTP adapter as well. In case of corrupted file, file will move to rejected folder.

      Delete
    2. Hi Vivek,

      Great post!
      Could you please let me know if there is any possibility to move the rejected messages to some folder in the same FTP Server from which we are reading file instead of "C:\Oracle\Middleware\user_projects\domains\base_domain\rejmsgs" from which we are reading file.

      Thanks,
      Ram

      Delete
  2. hi vivek garg : i have a situation where i receive the data in xml format which gives the status of a creditcard..i have to read that file from the folder and based upon the status i have some bpel process that will process further...i cant read the data .i.e from the element status in the xml file using file adapter...can u help me out how to read an xml file data and process it

    ReplyDelete
    Replies
    1. What error did you get while reading the file ? if your xml file is as per the schema then you should be able to read the file.

      Delete
    2. thanks for responding quickly..i am not getting an error ..i can receive the file but the data in the xml file is not populated in the output file thats the problem

      Delete
  3. can u add a post about how to receive data in xml format and populate the database using db adapter

    ReplyDelete
    Replies
    1. Please send me your code to gargvivek2008@gmail.com. I will look into it.

      Vivek

      Delete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. I Have One doubt,
    in my database adapter data(tables) is inserted but data is failed how can roll back to the data.

    Please send the logic in mail id:shaikdilip@gmail.com

    ReplyDelete