Friday, May 2, 2014

In previous post, we discussed about in-build error handling for file and ftp adapter. In-build error handling will put the corrupted file to default rejected message folder.

In this post, we will discuss about File Rejection Handler i.e. how to use Fault Handling Framework to handle errors when we encounter corrupt file during file polling.

Following error handler we can define inside fault policies to handler error.

·         Web Service Handler
·         Custom Java Handler
·         JMS Queue
·         File

We will discuss each error handler one by one. In this post we will discuss about “File” Rejection handler.

File Rejection Handler

By default adapter put the rejected message to default folder (C:\Oracle\Middleware\user_projects\domains\base_domain\rejmsgs) so we can configure this error handler if we want to put that rejected message to other location.

We need to use Fault Handling Framework to configure the error handler so we need to have fault-binding.xml and fault-policies.xml file.

Create a new fault-binding.xml file in the same project and add below content to it.

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings version="2.0.1"
   <service faultPolicy="RejectedMessage">

Please note that “PollCustomerData” is name of the adapter that poll the file.

Now create a fault-policies.xml file where we add fault and required action.

For this error handler below is the format for the action.

<Action id="ora-file">
<!-- FILE_NAME will support %ID%(rejected message instance id) or %TIMESTAMP% wildcards -->

Use below content for fault-policies.xml file.

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicies xmlns="">
  <faultPolicy version="2.0.1" id="RejectedMessage">
      <!-- remote fault: -->
      <faultName xmlns:rjm=""
          <action ref="ora-file"/>
    <!--write rejected message to file-->
      <Action id="ora-file">

Please not that fault policy id should be same in both fault-binding.xml and fault-policies.xml file.

Save your changes and deploy your composite.

Testing Result

Now put corrupted file to poll folder. You will see file got deleted and see two files in D:\rejectedmsgs folder.

rejmsg_40003_1399012637053 file contains file content.
rejmsg_40003_1399012637053_metadata file contains metadata information.

Download sample code from here.

Next post explains about next error handler, File Rejection Handler, Web Service Error Handler for File Adapter.


  1. hi vivek i got the following errors when i tried the above process ,
    in fault-policies.xml
    Warning(16,21): schema - (Error) Element 'fileAction' not expected.
    Warning(20,16): schema - (Error) Element not completed: 'Action'

    warnings in fault-bindings.xml
    Warning(5,43): schema - (Error) Element 'service' not expected.

    and in some cases i am getting like
    Warning(2,66): schema - (Error) Can not find definition for element 'faultPolicies'

    1. Please paste your both the files here. One of the error says , you didn't close the "Action" tag in the file.


    2. This comment has been removed by the author.

    3. This comment has been removed by the author.

    4. vivek my fault policies are not getting posted here..i dont no y??

    5. You can send it to my email id.


    6. Ever get past this error, I'm getting the same thing. Just curious if there was a trick.

    7. That was just a warning message, if you deploy your composite with this warning, your composite will work as expected.


  2. This comment has been removed by the author.

  3. fault bindings code


    fault policys code


    issue is the rejected file is moving to default rejected messages, that file need in this path /nfssoa/files/SOA4FSI_PROD/rejmsgs/FCUBS06BillPayPaymentCayInterface
    what i have to do?

    1. you can simply mention "/nfssoa/files/SOA4FSI_PROD/rejmsgs/FCUBS06BillPayPaymentCayInterface" path in location field.

  4. Hi Vivek,

    I am using FTP adapter to get files. Is there a way to redirect the rejected messages to same FTP server?


  5. Hi Vivek,

    Iam using FTP adapter to read files from remote server. Is there a way to write the rejected messages to some location iin the same FTP server instead of writing them in local SOA server.