SOA: Compensation Handling vs WS-AT

In SOA world there are multiple ways to handle failures within the services developed.

Many projects makes usage of SOA / BPEL services which invokes other SOA / OSB services which are deployed in a different domains.

The most common one I see are has been the Compensation Handler
For those not familair with it, the Compensation Handler is an alternative flow to be executed in case of Error or issues in your SOA Composites.

Another alternative (when services are out of your domain) is the usage of WS-AT (Web Service Atomic Transactions). To use Global Transactions within Web Services you need to know if the services you are calling are supporitng it or not.


More information of WS-AT (and how to enable it) is in:

https://docs.oracle.com/en/middleware/ws-manager/12.2.1.3/wscpt/introduction-using-web-services-atomic-transactions.html#GUID-8D2891C8-641B-4A1A-910E-77946380A31F

What is exactly WS-AT

I am not going to repeat the documentation and explain it with my own words with a basic example.

Imagine the following scenario:


  • Your application interacts with Service A.
  • Service A is deployed in Domain A and calls Service B and Service C which are deployed in Domain B.
  • If Service C call fails, then it is expected to rollback Service B.
So, usually Service A will have a Compensation Handling lane where the invocation to Service B will be reverted. This means to develop a service which cancels the service previously called
(if I have created something then I need to delete it).

Here, is where WS-AT can help you to avoid developing the "anti-service" to undo what was done.
Basically, Service A will become the Coordinator of a Global Transaction and Service B and Service C will become Participants of the Global Transaction.

This means if Service C failed then Service A will communicate to Service B to rollback the transaction instead of committing it.

How to Enable WS-AT for SOA?

First of all, patch your WebLogic Application Server to the latest patch as WS-AT endpoints has a HUGE vulnerability resolved in latest patches.

In addition, WS-AT Endpoints (http://.../wls-wsat) ARE DISABLED BY DEFAULT. You can enable them by following the WLST scripts explained in the official documentation

https://docs.oracle.com/middleware/12213/wls/WSGET/jax-ws-atomictransaction.htm#WSGET-GUID-AC002ED7-46F6-43B1-85A3-7EFAAB7E8DF9

My Example

In my example I have three SOA Composites:  


  • TestCompensation (Service A) 
  • DataApplicationA (Service B)  
  • DataApplicationB (ServiceC)
Service A initiates the Global Transaction. It is called the Coordinator. It pass the information to Service B (which is called Participant) and Service C (which is called Participant).

Now you just need to make sure your Service A requires a transaction and Service B and Service C to support join a coordinated transaction.
  • Service A: Outbound calls to Service B and Service C are mandatory to join the Transaction.



  • Service B and C: Inbound Supports to join a Global Transaction.


Issues

Currently, I am stuck on a problem within the Global Transaction and the SOA Suite. I raised an Oracle SR. Will update this post as soon as it is solved.

My Conclusion

  • Give it a try. It is worthwhile to make it running and avoid to write infinite Compensation Handling steps.
  • When tried in 12.2.1.2 I were not able to make the wls-wsat endpoints in Oracle WebLogic Server. So I decided to try it in 12.2.1.3 where I could enable them.
  • During the  tests in 12.2.1.3 I am facing an internal NullPointer exception of WebLogic Application Server which I did not provided to Oracle as this Service Request was taking too much time to be solved.
Kind regards.

Comments

Popular posts from this blog

OJET: Build and Deploy in an Application Server

OJET: Select All options using only Checkboxset

OFMW: 12.2.1.4 Released