Saturday, August 22, 2009

Business Events and ADF Business Components in Oracle Fusion 11g

I continue a series of posts, where I'm describing Oracle SOA Suite 11g and JDeveloper 11g functionality. Before reading this post, you might be interested to read my previous posts - Web Service Interface for ADF BC Application Module in Oracle Fusion 11g and Service-Enabled Entity Objects in Oracle Fusion 11g. My today post sample application is based on mentioned blog posts.

Business Events and Event Delivery Network (EDN), its something that makes Oracle SOA Suite 11g really strong integration platform. While discussing with customers, usually everyone is seriously concerned about loosely coupled integration, no one wants to integrate IT systems with strongly coupled services. Thats logical, because there are different systems and those systems constantly changing. Oracle SOA Suite 11g allows to implement loosely coupled integrations with Business Events. You can understand Business Event as a signal, that was sent by radio transmitter. Transmitter knows nothing about receivers, its receivers business to subscribe to particular event. Oracle SOA Suite 11g brings Event Delivery Network (EDN), space where Business Events can be raised and received across SOA infrastructure. Business Events in SOA Suite 11g can be raised not only from ADF Business Components, but from BPEL process for example as well.

Today I will use both applications from my previous posts mentioned above. I will add Business Event to application described in Service-Enabled Entity Objects in Oracle Fusion 11g post, you can download updated sample - SalaryUpdateRemote2.zip. Additionally for today post I have implemented SOA Composite where I'm subscribing to Business Event raised from ADF Business Components - SalaryManagement.zip. You can find more info about Business Events and EDN in Oracle SOA 11g Developer Guide Section 44 Using Business Events and Event Delivery Network, also check Edwin Biemond post - Events in ADF BC and handled by the SOA Suite Mediator.

Good news - we can declare Business Events on Service-Enabled Entity Objects, it works same as declared on normal Entity Object. Here is declaration:


In Business Event definition I have specified to track Salary attribute value changes. Along with changed Salary attribute value, I want to add to the payload EmployeeId attribute value. Event is published and will be raised during Update action based on Salary attribute change.

Thats all about Business Event definition in ADF Business Components, now I will develop SOA Composite where I will subscribe to Business Event. Implemented SOA Composite:


SOA Composite contains two Components (Mediator and BPEL process) and one External Reference (File Adapter):


Mediator subscribes to Business Event, and forwards it to BPEL process, where Business Event data is written to file system. In this post I'm focusing on Business Events from ADF Business Components, in my next post I will focus on BPEL process implementation. Mediator receives Business Event, BPEL process will manage it, this means Business Event schema transformation should be defined:


Schema transformation can be done automatically in JDeveloper 11g:


Basic BPEL process for today post, received Business Event data is stored in file system using File Adapter:


File adopter is defined with the same WSDL as BPEL process, means it will know Business Event input data format and will store information in C:/tmp folder:


I have deployed both applications (ADF application and SOA Composite) to Oracle SOA Suite 11g WebLogic server and opened ADF Application screen:


Data is retrieved through Service-Enabled Entity Object from Web Service. I will change Salary value and press Save button to update Salary attribute value:


Business Event was raised from ADF Business Components, subscribed Mediator from SOA Composite received it and forwarded to BPEL process where data was written to file system:


You can see that we received Employee Id and changed Salary attribute values.

Let's see process flow in Oracle Enterprise Manage Web console for Oracle SOA Suite 11g. We can see there log for all SOA Composite - SalaryUpdateComposite instances:


If I click on latest instance, I will get its trace log:


You can click on SalaryManagementProcess and open visual process flow:


And finally if you click on InvokeSalaryChangeLog BPEL Invoke activity, as well you will see there data from Business Event:


Spanish Summary:

Este post muestra una carateristica de integración entre Jdeveloper 11g and SOA Suite. En esta oportunidad se muestra el uso de los Business Events, para intercambiar y almacenar información de los salarios de los empleado usando SOA y los ADF Entity Objects.

Thursday, August 13, 2009

Service-Enabled Entity Objects in Oracle Fusion 11g

In Oracle Fusion 11g, JDeveloper provides great support for Application Integration Architecture (AIA) through Service-Enabled Entity Objects. It allows to build Enterprise Composite Applications (ECA) in Oracle ADF. Developer now can implement Entity Objects directly based on View Objects from remote application, exposed through Web Service. This means we can expose and consume Web Services on Model level using ADF Business Components, this gives more centralized integration approach. Its especially important for AIA, when building ECA. For more info, please read Section 11.3 Accessing Remote Data Over the Service-Enabled Application Module from Oracle Fusion Developer Guide. In this post I will describe some tips and tricks from my experience.

I have investigated Service-Enabled Entity Objects in greater detail and developed sample application. Sample is based on two JDeveloper 11g applications, first - SalaryUpdateRemote.zip is consuming remote Web Service on Entity Object level, second - SalaryControlService2.zip implements this Web Service. Application with Web Service implementation was developed in my previous post - Web Service Interface for ADF BC Application Module in Oracle Fusion 11g, where I have described how to expose through Web Service custom methods from Application Module implementation class. I have updated previously developed application in order to use it in current post, additionally have exposed View Object itself through Web Service.

I'm using Employees View Object from SalaryControlService application to be accessed through Web Service:


In SalaryControlService Application Module Service Interface, you can see EmployeesView1 exposed as View Instance:


I have declared three operations to be enabled for EmployeesView1. Find is required operation to retrieve data, Update operation will be used to edit employees data through remote Entity Object:


When Service Interface for View Object is defined, we can redeploy SalaryControlService. I have accessed redeployed application through Enterprise Manager console, updated list of operations is present now:


We need to note down WSDL URL, it will be needed soon, when we will define Entity based on Service Interface.

Its time to open application, where View Object is consumed over Web Service - SalaryUpdateRemote. Its pretty basic application:


Only one interesting thing - Employees Entity Object is based on Service Interface, we can see this from DataSource tag. This Entity Object is based on View Object exposed through Web Service, instead of Database table:


When you base Entity Object on Web Service interface, same as you generate it from Database table, all attributes are defined:


To create Entity Object based on Service Interface, in Create Entity Object wizard select Service Interface option for Data Source. You will be requested to provide WSDL URL for Web Service, available Service View Instances will be listed automatically:


All other steps are the same, as when creating Entity Object based on Database table. When I have created View Object referencing Service-Enabled Entity Object, I have noticed that Query section is empty:


Thats logical, because data will be retrieved on runtime through Web Service. However, this means that Service-Enabled Entity Objects can't participate in joins and can be used only as primary objects. For more info read Section 11.3.7 What You May Need to Know About Service-Enabled Business Component Restrictions from Oracle Fusion Developer Guide.

Finally, in order to test Service-Enabled functionality, as described in documentation you need to include common library from Web Service application:


And define service connection information in connections.xml file:


You can copy paste this information from Web Service application and just add couple parameters. In documentation they say we can access remote Web Service with Local or Remote Business Components Service configuration. Local can be used when Business Components Service runs local to the consuming application. However, I wasn't able to run with Local configuration, seems it was trying to load two Application Modules on Class Path and then conflicting. Good news, I was able to run with Remote configuration:


In jndiProviderURL I have specified IP and Port of my WebLogic domain extended with SOA support.

Now its time to run Application Module and test Service-Enabled Entity functionality:


Because I have enabled Find and Update operations, I can browse and edit data retrieved from Web Service View Object instance:


I have developed ViewController part as well, where I have implemented simple edit type form for Employees data. Finally, I have deployed application with Service-Enabled Entity Object to the same WebLogic domain with SOA support, where original ADF BC Web Service was deployed. I have noticed, if you want to use Service-Enabled Entity Object in ViewController, common library from Web Service application should be added to ViewController classpath:


But its not enough, additionally you should open deployment profile and in WEB-INF/lib Contributors section ensure that added common library is selected for deployment:


If its not selected, this means it will be not packaged into EAR there will be runtime exception when trying to access Web Service through Entity Object.

When SalaryUpdateRemote application is deployed:


We can access main page and retrieve Employees information through remote Web Service directly using ADF Business Components. Data can be edited and saved to database through Web Service:


Its very interesting and useful functionality, if there will be decision to implement Salary attribute validation rule, there is no need to implement it on Service-Enabled Entity:


It can be done directly on original Entity Object available in ADF Business Components exposed through Web Service - SalaryControlService application:


Data from consuming application will be sent to Web Service and validated there centrally. In case of invalid data, remote application will show error:


Spanish Summary:

Este post ofrece un ejemplo de una nueva caracteristica que ofrece Jdeveloper para permtir la creacion de entidades en base a ViewObjects que pertenecen a aplicaciones remotas, las cuales son accedidas por medio de WEB Services. De esta manera nuestras aplicaciones pueden implementar rápidamente Enterprise Composite Applications (ECA) usando ADF.

Saturday, August 1, 2009

Web Service Interface for ADF BC Application Module in Oracle Fusion 11g

I'm starting series of posts where I will describe how you can orchestrate and connect various services in your infrastructure with Oracle Fusion/SOA 11g. I will follow such plan during my infrastructure implementation:
  • Will create Web Service interface for Application Module and expose custom methods
  • Will create second application, where will raise Business Event
  • Will create BPEL composite, this composite will be subscribed to raised event and will route process according Human Task outcome
Today I will cover first step from my plan and will define Web Service interface for custom methods based on ADF BC Application Module. You can download sample application and deploy it in your standalone Oracle WebLogic environment - SalaryControlService.zip.

Let's describe application structure, Web Service deployment and test process in Oracle Fusion 11g. You can find additional info on this topic in Oracle Fusion 11g Developer Guide - Integrating Service-Enabled Application Modules.

First, developed application contains two custom methods developed in Application Module implementation class - updateSalary and emplWorkLoad. I have exposed them through Client Interface as custom Java methods in order to test easier in ADF Business Components Browser utility:


Methods are pretty simple:


updateSalary method gets specific row by its Id and updates Salary attribute with provided value. emplWorkLoad method executes read-only View Object with Bind Variable and gets summarized information for employee workload. Read-only View Object implements query statement with grouping and MONTHS_BETWEEN function:


Oracle ADF allows to generate access through Web Service not only to custom methods, but to Application Module data model itself, however I prefer to access custom methods. Service Interface for two custom methods access through Web Service is defined:


In Application Navigator you can see that Web Service artifacts are generated by JDeveloper 11g:


  • Remote common interface - HrModuleService.java
  • Remote service schema - HrModuleService.xsd
  • Remote service definition - HrModuleService.wsdl
  • Remote service class - HrModuleServiceImpl.java
Now we can simply deploy Application Module exposed through Web Service to Oracle WebLogic and test it. In order to do this, in your Model project define deployment profile for Business Components Service Interface:


In Application deployment profile verify that Model profile is used:


When prerequisite steps are done, deploy application directly from JDeveloper 11g to WebLogic server. After deployment is finished successfully, you can open Oracle Enterprise Manager console and monitor deployed Web Service performance:


From Web Services section box, you can invoke Test functionality - Test Web Service screen will be opened:


Let's test now emplWorkLoad method, provide value for employeeId input argument and press Test Web Service button:


Response is generated and we can see successful Web Service execution result:


Now let's test second method - updateSalary:


Provide values for input arguments:


Invoke Web Service test, result should be successful:


Employee (Id = 101), Salary attribute value is updated correctly: