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
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.
- Create a new Fusion Web Application (ADF) Application and click OK
- Provide an Application Name, GetCustomerADF and click Next
- From the Project Technologies move Web Services into the Selected box. Accept the defaults and click Finish.
- Right-click the Model project and select New
- In the Gallery select Web Services –> Web Service Data Control then click OK.
- Provide a name GetCustomerDC and give the URL endpoint for the Web Service, then click Next
- Select the web service operation you want to use for the ADF application. In my example my web service only has one operation.
- Click Finish
- Save your work, File –> Save
- The data control has now been created, the next steps create the UI components.
- In your application created in step 1 find the ViewController project, right-click and choose New
- In the Gallery select JSF –> JSF Page
- 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.
- I only want 2 columns so I delete the last column but right-clicking the right had panel and selecting Delete
- 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
- 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.
- You now need to provide the mappings, Choose the ‘Show EI Expression Builder’
- Navigate to the bindings, ADFBindings –> bindings –> parametersIterator –> currentRow
- Click OK
- Drag and drop the return information
- I just want the results shown in a form. I want to show all fields
- Now it is time to test, Right-click the jspx page created in steps 11 – 21 and select Run
- A browser should start, enter valid values and test
© Oracle Blogs or respective owner