Adding a custom method in an ADF BC Service Interface – update of a single attribute in a selected r
2014-05-21 10:48
381 查看
Adding a custom method in an ADF BC Service Interface – update of a single attribute in a selected row
3BY LUCAS
JELLEMA ON
DECEMBER 30, 2010 ·GENERAL, JAVA
EE/JAVA, ORACLE, ORACLE
ADF, SOA & MIDDLEWARE
The article “Quickly creating, deploying and testing a WebService interface for ADF Business Components” (http://technology.amis.nl/blog/9726/quickly-creating-reploying-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.
?
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.
Related posts:
How
to refer to an Attribute in the Currently Selected Table row in an ADF Faces page – implementing a Generic Row Reader
Quickly
creating, deploying and testing a WebService interface for ADF Business Components
Oracle
& JDBC – Passing a 'table of custom object type' to a stored procedure – implementing efficient single round trip data exchange (part two of an ADF application on a PL/SQL API)
JHeadstart
ADF Generation with Custom Templates – using custom properties when none are available
ADF11gR2:
Plotting custom locations on a Thematic Map using a GeoCoder Service
相关文章推荐
- An error occurred at line: 307 in the generated java file The code of method _jspService (HttpServle
- 给ADF BC EO Row或Attribute添加Custom异常
- Changing Configuration Values of a Configurable Material in a SO, PO or a Service Order through an ABAP Program
- How can I get the IPv4 address of an interface in linux from C code ?
- The type OneInterface cannot be a superinterface of OneInterfaceImpl; a superinterface must be an in
- Call multiple URLs on single click of af:goLink in Oracle ADF
- Invalid update: invalid number of rows in section 0. The number of rows contained in an ....
- An Analysis of Single-Layer Networks in Unsupervised Feature Learning(精读)
- Here's an example that shows how to enumerate through the features of a selection set, returning the value of each field in the attribute table except for the geometry colum.
- What’s the behavior when calling an overwritten virtual method in the constructor method of a base class?
- An Analysis of Single-Layer Networks in Unsupervised Feature Learning
- The method below converts an array of objects to a DataTable object in C#.
- SQL Error:An aggregate may not appear in the set list of an UPDATE statement.
- Q.2.3 Implement an algorithm to delete a node in the middle of a single linked list, given only acce
- Add a file to a Document Library and update metadata properties in a single method添加文档的方法
- 删除tableview的section遇到crash:The number of rows contained in an existing section after the update
- How to get IOleSite interface of the WebBrowser in an ActiveX control
- Each child in an array or iterator should have a unique "key" prop. Check the render method of `Tabl
- An extender can't be in a different UpdatePanel than the control it extends
- Process of creating an object in Java