Calling Web Services using ADF 11g

Posted by James Taylor on Oracle Blogs See other posts from Oracle Blogs or by James Taylor
Published on Fri, 04 Jun 2010 02:02:14 +1300 Indexed on 2010/06/03 13:27 UTC
Read the original article Hit count: 472

Filed under:

One of the benefits of ADF is that fact that it can use multiple data sources. With SOA playing a big part in today’s IT landscape, applications need to be able to utilise this SOA framework to leverage functionality from multiple systems to provide a composite application.

ADF provides functionality to expose web services via the ADF Business Component so if you know how to use Business Components for a database. Configuring ADF for web services is much the same.

In this example I use an OSB web service that gets a customer.

  1. Create a new Fusion Web Application (ADF) Application and click OK

    image  
  2. Provide an Application Name, GetCustomerADF and click Next

    image  
  3. From the Project Technologies move Web Services into the Selected box. Accept the defaults and click Finish.

    image
  4. Right-click the Model project and select New

    image
  5. In the Gallery select Web Services –> Web Service Data Control then click OK.

    image
  6. Provide a name GetCustomerDC and give the URL endpoint for the Web Service, then click Next

    image
  7. Select the web service operation you want to use for the ADF application. In my example my web service only has one operation.

    image
  8. Click Finish
  9. Save your work, File –> Save
  10. The data control has now been created, the next steps create the UI components.
  11. In your application created in step 1 find the ViewController project, right-click and choose New

    image
  12. In the Gallery select JSF –> JSF Page

    image
  13. Provide a name for the jsp page, GetCustomer, Also ensure that the ‘Create as XML Document (*.jsp) check box is checked. I have selected the page template, Oracle Three Column Layout but you can create a layout of your choice.

    image
  14. I only want 2 columns so I delete the last column but right-clicking the right had panel and selecting Delete

    image
  15. Drag the fields you require from the web service data control to the left pannel. In my example I only require the Customer ID. When you drag to the panel select Texts –>ADF Input Text w/Label

    image
  16. In this example I want to search on a customer based on the ID. So Once I select the ID I want to execute the request. To do this I need a button.
    Drag the operation object under the fields created in step 15. Select Methods –> ADF Button.

    image
  17. You now need to provide the mappings, Choose the ‘Show EI Expression Builder’

    image
  18. Navigate to the bindings, ADFBindings –> bindings –> parametersIterator –> currentRow

    image
  19. Click OK
  20. Drag and drop the return information

    image
  21. I just want the results shown in a form. I want to show all fields

    image
  22. Now it is time to test, Right-click the jspx page created in steps 11 – 21 and select Run

    image
  23. A browser should start, enter valid values and test

    image 

© Oracle Blogs or respective owner