Friday, March 6, 2015

Invoking REST Service from Oracle ACM Java Activity

In this post I will show you, how to call REST service from ACM Java activity class method. This could be useful in the situations, when you would like to have programmatic ACM activity integrated with REST service data. We could access ACM payload data from within the method overriden in the class implementing Case Activity Callback.

ACM activity implemented on top of Java class, contains the same properties and configuration as the regular one. You could define input/output data, execution properties, etc.:


Here is the Java code to invoke REST service from the Java class implementing ACM activity. I'm giving an example to parse ACM payload and access Last Name attribute. REST service is invoked through a library packaged with FMW 12c:


One important hint - you must place ACM activity class under SOA/src path (by default it goes into SOA/SCA-INF/src). This will ensure class will be compiled and executable on runtime:


REST Client library is referenced from FMW 12c installation, no need to add any external libraries:


Sample application implements Cancel Hotel Booking activity, the one which is based on Java class. It executes and calls a method:


Here is the output - Last Name printed out from the payload and REST service call result:


Here you can download sample application, this contains both REST service and ACM examples - HotelBookingProcessing_v2.zip. REST service application implementation - ADF BC Range Paging and REST Pagination. ACM application implementation - Adaptive Case Management 12c and ADF Human Tasks.

No comments: