Tuesday, December 2, 2014

Review - WS-BPEL 2.0 Beginners Guide

Few weeks back I started reading WS-BPEL 2.0 Beginner’s Guide. So, I thought I should post my review on the blog. As the name of the title suggests, this book is for the beginners who are new to BPEL and just started learning the concepts of BPEL. It is written by Matjaz Oracle Ace Director, java Champion and Denis Weerasiri (Ex WSO2 Enginner and PhD).

I would say the authors of this book have done a great job by keeping it simple and easy to learn yet explaining all the concepts in detail. BPEL is not a programming language but still its little complex to understand. All the fundamentals, basics and concepts of BPEL are very well covered in this book from structure and syntax of the BPEL to the different types of activities and business processes. Steps by step BPEL process creation is explained along with well documented screenshots. You can easily create a sample service, deploy it and test it. Guess what even the deployment steps are also explained.

You can test your knowledge , how much you have understood by answering the quiz at the end of each chapter. There are also number of use cases that you can implement based on the understanding you have developed after reading the book.

I would really recommend this book for all the beginners wanted to learn BPEL. Even though, the name suggests the book is for beginners, but even the experts can also use this book for reference.
For your reference, here is the link to get this book: WS-BPEL 2.0 Beginners Guide

Hope you all benefits from reading this book.

Happy Learning !!!

Wednesday, January 29, 2014

Handling Rejected Messages - SOA 11G

Hi Guys,

Was busy past couple of months due to work and all. Finally got time to wrtie a new blog. Today, I would be explaining how do you handle rejection messages in BPEL. Rejection messages are basically the messages your composite receives but its not as per the format expected by your service , due to which BPEL instance do not get created. So your flow doesnot goes into your BPEL and there is no way to handle that exception in your code.

Below is the extract taken from Oracle:

The messages that error out before being posted to the service infrastructure are referred to as rejected messages. For example, the Oracle File Adapter selects a file having data in CSV format and tries to translate it to XML format (using NXSD). If there is any error in the translation, this message is rejected and are not be posted to the target composite.
Primarily, adapters and binding components are the generators of rejected messages.

To handle such scenarios where you need to take specific action if you get rejected messages, you can use fault management framework. Lets do it step by step.

To illustrate this, I have created sample interface that reads a CSV file from a location and there is only single receive activity inside the BPEL that will receive the input.

Based on the CSV file , I have created a sample schema and configured our File adapter to read the file based on this schema.

My composite is already deployed on EM. Lets test it. This is the file that I have placed in input directory.

Instance will be created , since the file is in correct format. Verify by opening the instance and checking your input.

Now create a Fault Policy file and fault bindings file and place it in the folder that has composite.xml.

Open the fault policy file and define a fault policy for the rejected messages in the fault-policies.xml file, stored with the composite.xml file in the JDeveloper project directory. In the file add the name of your service adapter in the faultname section. In our case it is "readFile". And the action define "writeTofile" that will write the rejected message in the location specified with the filename that is given.

Now associate the fault policy with a service endpoint of the composite in fault-bindings.xml, as is done in the following screenshot:

Deploy your composite and place some file in the input directory thats not as per the schema.

New instance wont get genereate. Instead you will see error message under "Faults and Rejected Messages". Click on the error message and open payload. 

Now this failed message will be writtten to the file and the location that we gave in our fault policy. Go to that location and verify the same.

This way , we can handle rejection messages and take appropriate actions depending upon the requirements.

For more information please refer Oracle Documentation: Rejection Messages

Hope this post was useful to you.

Happy Learning,