Friday, May 2, 2014

In previous post, we discussed file error handler which handle the rejected file and put that to custom folder with custom file name. In this post we will discuss about next error handler which is web service handler.

In web service handler rejected message is handled by web service, there is predefined WSDL interface which have to use to create web service which will handle the rejected message.

Below is the schema that we need to use for that web service.

<?xml version="1.0"?>
<schema xmlns=""
  <element name="RejectedMessage" type="tns:RejectedMessageType"/>
    <complexType name="RejectedMessageType">
       <!-- base64 encoded strings" -->
          <element name="MessageHeader" type="string"/>
          <element name="MessagePayload" type="string"/>
          <element name="RejectionReason" type="string"/>
      <attribute name="RejectionId" type="string"/>

Follow below steps to use web service handler for rejected file.

Web Service Handler Service

First create a web service for web service handler which will handle rejected file. Use above mentioned schema and make sure web service has only one port type and one input operation.

You can add required logic to it. For this post, we will not add any logic to it.

Save the composite and deploy it to the server.

Below is the endpoint of web service handler.

File Polling Service

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-ws">
  <invokeWS uri="WebServiceURI"/>
<!-- format - <Absolute wsdl path>|service name|port name -->

Please add below content to 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-ws"/>
      <!--invoke web service for rejected messag-->
      <Action id="ora-ws">
        <invokeWS uri="http://localhost:8001/soa-infra/services/default/WebServiceHandler/webservicehandlerbpel_client_ep?WSDL|webservicehandlerbpel_client_ep|WebServiceHandlerBPEL_pt"/>

Save your changes and deploy this composite to server.


Put file corrupted file to polling location. You should see new instance of web service handler.

Download sample code from here.

Next post explains about next error handler, File rejection Handler- JMS queue error Handler for File Adapter.


  1. Hi Vivek,

    One question regarding the fault policy. Is the action 'invokeWS' been removed from the version or the format to invoke a deployed webservice changed in this version ? I am trying to call a weservice using fault-policy in my code, but the 'invokeWS' part is not working and gives 'java.lang.NullPointerException'. Do you have any idea regarding this scenario ?

    However if I try to call the action 'writeToFile' or 'human-intervention' these are working fine. But only the 'invokeWS' part is not working using :


    1. Hi Vatan,

      I haven't tested this on version. I tested it on version. I know there was one bug in version for custom java handler and that was corrected in next version but not aware if they made any changes for web service handler.


  2. Hi Vivek,
    How can we handle invokeWS URI dynamically - If we move from Dev to QA to Prod, is any way we can control via EM Console ?