Adding a custom method in an ADF BC Service Interface – update of a single attribute in a selected row

Lucas Jellema 3
0 0
Read Time:3 Minute, 3 Second

The article “Quickly creating, deploying and testing a WebService interface for ADF Business Components” ( that I recently published describes a way of very rapidly creating the HRService Web Service – an ADF BC driven WebService on top of the EmployeesView ViewObject that exposes the EMPLOYEES table in the HR schema through the Employee EntityObject. However, that article’s true purpose is to show how to create the deployment profile and deploy and test this service, either on the integrated WLS or on a standalone WebLogic Server, in the easiest way possible. This article is an extension of the previous one: it demonstrates how to extend the Service Interface with a custom method (or an operation in terms of WebServices).

As it happens, I required an operation for updating just the salary of an Employee. I will show how I create a custom method in the Application Module’s implementation class, how I added this method to the Client Interface of the Application Module and subsequently to the Service Interface. After redeploying – using the same deployment profile that was created previously – we can test the updateSalary method as a new operation in the WebService.

Open the Application Module editor. Go to the Java tab and click on the edit (pencil) icon. Check the checkbox to Generate Application Module Class HRServiceImpl.

Then press OK.

Click on the hyperlink for HRServiceImpl. The java editor opens for class HRServiceImpl.

Implement method updateSalary. The method takes two integers – the employee identifier and the newly awarded salary – and returns a String as result.


The code will first leverage the EmployeesView1 ViewObject to get hold of the employee’s Row for the employeeId (the primary key for this ViewObject). When found, the Salary attribute is updated, and the result string is composed.

    public String updateSalary(Integer employeeId, Integer newSalary) {
        String result="";
            Row[] rows =
                getEmployeesView1().findByKey(new Key(new Object[] { employeeId }),
            if (rows != null && rows.length > 0) {
                Row row = rows[0];
                row.setAttribute("Salary", newSalary);
                result =
                        "Updated Salary for " + row.getAttribute("FirstName") +
                        " " + row.getAttribute("LastName") + " to " +
      return result;

With the method now available in the ApplicationModuleImpl class, we can add it to the Client Interface.

Back in the Java tab for the Application Module, click on the edit (pencil) icon to edit the Client Interface:L


In the Client Interface editor, select the new method updateSalary to add to the Client Interface.


Click on OK.

With the Client Interface appropriately extended, we can now edit the Service Interface likewise.

Go to the Service Interface tab for the Application Module. Click on the icon to edit the Custom Methods for the Service interface.


Select the updateSalary method. Then press OK.


The definition of the Service Interface for Application Module HRService is now extended with the updateSalary salary, that will be exposed as Operation updateSalary in the Web Service.


Redeploy the application using the application deployment profile discussed in the prequel to this article.

Then open your browser to test the web service, in my case at: http://localhost:8001/HRDataServices/HRService.


Select operation updateSalary that is now available for the first time. Specify employee identifier and new salary. Then press the Invoke button.

The response from the WebService appears:


When we check the database, we will find that the salary has indeed been updated:


Through Custom Methods, it becomes very easy to provide dedicated, fine grained operations (or composite, very coarse grained operations)  in the WebServices published for our Application Modules.

About Post Author

Lucas Jellema

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.
0 %
0 %
0 %
0 %
0 %
0 %

Average Rating

5 Star
4 Star
3 Star
2 Star
1 Star

3 thoughts on “Adding a custom method in an ADF BC Service Interface – update of a single attribute in a selected row

  1. Hi Lucas, that’s a nice post. I’m wondering if I can use a custom method in the appModule using a ViewObjectNameImpl and calling the createRow and the insertRow method of the view.
    Thanks in advance.

  2. Great post. Thanks.
    Now what if I need to expose a method in AMImpl which has let’s say a complex type, for example a DTO or an VO itself with limited number of attributes ?

  3. Hey I put my code in the impl but the function name does not appear in the list from i can shuttle it, Any suggestions I am trying to do it declaratively and trying to avoid coding it in

Comments are closed.

Next Post

Oracle 11g SOA Suite read multi record data from csv file with the file adapter (master-detail)

The file adapter is a very powerlful tool to read files with structured data. Most of the time you will read simple csv files with one record per row. But what if your csv file contains multiple records with different types. Even then you can use the file adapter. Case […]
%d bloggers like this: