Part 6: Developing an ADF Client Using a Web Service Data Control
Web services allow enterprises to expose business functionality irrespective of the platform or language of the originating application. The business functionality is exposed in such a way that it is abstracted to a message composed of standard XML constructs that can be recognized and used by other applications. Oracle ADF provides an access layer that can be used to access many types of business or data services, include Web Services.
show more or less

The most common way of using web services in an application developed using Oracle ADF is to create a data control for an external web service. A typical reason for doing this is to add functionality that is readily available as a web service, but which would be time consuming to develop with the application, or to access an application that runs on a different architecture.

Additionally, you can reuse components created by Oracle ADF to make them available as web services for other applications to access.

Step 1: Creating the Web Service Data Control

In this section you use the WSDL deployed to the integrated server and create a data control from it. Your application will not contain the original Java code as in the previous scenarios; it creates the data control from the deployed WSDL. Once you create the data control, any ADF client application can use it.

  1. In the Application Navigator, click the down-arrow to the far right of the Application name and select New Project from the menu.

    application navigator

  2. In the new Gallery, select Web Project and click OK.

    new gallery

  3. In the Create Web Project wizard, name the project WebClient. Click Next and Next again.

    create web project step 1

  4. In the Page Flow Technology step of the wizard, select JavaServer Faces (JSF), and click Next.

    create web project step 3

  5. In the tag libraries, shuttle the ADF Faces Components 11 from Available Libraries to Selected Libraries

    create web project step 4

  6. Click Next.

    create web project step 5

  7. Click Next and Finish.

  8. In the Application Navigator, right-click the WebClient node and select New from the context menu.

    application navigator

  9. In the New Gallery, in the Business Tier select the Web Services node and choose the Web Service Data Control in the Items list and click OK.

    new gallery

  10. In the first step of the Create Web Service Data Control wizard, name the data control MyCompanyDC, and then paste the WSDL URL that you copied earlier: 

    As before, append ?WSDL to the URL. When you press [Tab], the web service for the data control is populated.

    create web service data control step 1

  11. Click Next.

  12. In the Data Control Operations page, shuttle the getDeptInfo method to the Selected side.

    create web service data control step 2

  13. Click Next, then Finish.

    The Application Navigator should look something like:

    application navigator

  14. Click Save All save all to save your work.

  15. Expand the Data Controls accordion in the Application Navigator to expose the MyCompanyDC data control that has just been created.

    data control pane

    At this point you are ready to create the JSF page and use the data controls.

Step 2: Creating a JSF Page to Consume the Web Service Data Control

In this section you update the client class to invoke the web service proxy and return the result to the message window.

  1. Invoke the New Gallery from the WebClient project.

    application navigator

  2. Expand the Web Tier node and select the JSF / Facelets  sub node. In the Items column, select Page and click OK.

    new gallery

  3. Name the page Dept_Emp, select the Create as JSP XML radio button, and checking the Page Template, select the Oracle Three Column Layout and click OK.

    create j s f page

    The page will open in the page editor

    page editor

    You now add the data controls for the method. The page should accept a parameter, execute the call to the web service, and return the results in a Master Detail layout.

  4. In the Data Control panel, expand the MyCompanyDC data control and select the getDeptInfo(Integer) method.

    data control pane

  5. Drag the getDeptInfo(Integer) method onto the start facet of the page. When you drop it, a menu is displayed. Select ADF Parameter Form.

    jsf editor

  6. In the Edit Form Fields window click OK to accept the default values.

    edit form fields

  7. Click OK.

  8. In the Data Controls panel, expand MyCompanyDC | getDeptInfo(Integer) | Return | Return and select employees.

    data controls palette

  9. Drag employees onto the center facet. In the dynamic menu select Master-Detail | ADF Master Form - Detail Table.

    j s f editor

  10. Click Save All save all to save your work.

  11. Right-click within the end facet and select Delete from the context menu.

    j s f editor

  12. In the Structure window for the page, expand the center facet. Under the center facet, expand the af:panelGroupLayout - vertical and the af:panelHeader - employees nodes.
    Right-click the af:table - t1 component and select Surround With from the context menu.

    structure pane context menu

  13. In the Surround With window select the Panel Collection and click OK.

    surround with dialog

  14. Expand the panelCollection and select the af:table - t1 component. In the Property Inspector, set the Column Selection property to single.

    property inspector

  15. Right-click within the page and select Run from the context menu.

    j s f page context menu run

  16. The page loads into your default browser.

    running page

  17. In the parameter field enter a department value and click the getDeptInfo button.

    running page get department info

  18. The related employees are retrieved and displayed

    running page with data


In this tutorial you have seen how to create Web Services from two perspectives; Top-down and Bottom-up. In the Top-down approach you created Web Services from scratch based on what you wanted to do. In the Bottom-up sections, you created Web Services based on existing services. You learned how to: To learn more about creating enterprise applications using ADF with JDeveloper, refer to:

Bookmark Print Expand all | Hide all
Back to top

Did you find this page helpful?

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.