Calling Web Services using ADF 11g

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
Comments:

ADF is really very useful application for web services. thank you for your post. its very useful for web developers.

Posted by Denver Website Designs on November 01, 2011 at 04:10 PM GMT+13:00 #

This was very quick and helpful. Thanks.

Posted by guest on December 19, 2011 at 05:15 PM GMT+13:00 #

When i am creating web service Data Control, jdeveloper is throwing below error.

DCA-29000:Unexpected exception caught:
java.lang.NullPointerException,msg=null

Posted by guest on March 09, 2012 at 05:51 AM GMT+13:00 #

This is a fairly generic error, could be caused by connectivity issues to the web service from the development machines.

cheers
James

Posted by James Taylor on March 09, 2012 at 10:54 AM GMT+13:00 #

Not aware of any bug, do you have any details? One thing to check is if you are going through a proxy server to the outside world you will need to configure the proxy server for jDeveloper.

tools -> preferences -> web / proxy

cheers
James

Posted by James Taylor on March 09, 2012 at 12:56 PM GMT+13:00 #

Hello, i completed the tutorial, but i have one question:
when i load the page from weblogic server the web service(on soa server) is call 2 times with null payload, and when i press the button is called 3 times. This problem is only when using datacontroller"

<?xml version="1.0" encoding="UTF-8" ?>
<DataControlConfigs xmlns="http://xmlns.oracle.com/adfm/configuration"
version="11.1.1.55.36" id="DataControls"
Package="oracle.model">
<AdapterDataControl id="istorictranzactii"
FactoryClass="oracle.adf.model.adapter.DataControlFactoryImpl"
ImplDef="oracle.adfinternal.model.adapter.webservice.WSDefinition"
SupportsTransactions="false"
SupportsSortCollection="false" SupportsResetState="false"
SupportsRangesize="false" SupportsFindMode="false"
SupportsUpdates="false"
Definition="oracle.model.istorictranzactii"
BeanClass="oracle.model.istorictranzactii"
xmlns="http://xmlns.oracle.com/adfm/datacontrol">
<Source>
<definition xmlns="http://xmlns.oracle.com/adfm/adapter/webservice"
name="istorictranzactii" version="1.0"
provider="oracle.adfinternal.model.adapter.webservice.provider.soap.SOAPProvider"
wsdl="http://mch-soa1vhn1.adfiba.local:8001/soa-infra/services/default/IstoricTranzactii/InITr01?WSDL">
<service name="bpelprocess1_client_ep"
namespace="http://xmlns.oracle.com/IB_Intesa_jws/IstoricTranzactii/BPELProcess1"
connection="istorictranzactii">
<port name="BPELProcess1_pt">
<operation name="process"/>
</port>
</service>
</definition>
</Source>
</AdapterDataControl>
</DataControlConfigs>

Posted by serban on August 08, 2012 at 04:09 AM GMT+13:00 #

I have been given the reason for why this happens but I forget, it has something to do with the auto submit that you may require to populate other fields when a button is clicked.

To get around this you need to do some expression language for the fields you DONT want populated. In the properties there should be a parameter, RefreshCondition. This is where you put your expression language. Here is an example,

#{bindings.password.inputValue ne null}

Basically what this does is checks an unpopulated field whether it is null. When you enter this page it is always null so the code wont be refreshed.

Posted by James Taylor on August 08, 2012 at 11:55 AM GMT+13:00 #

Nice Blog !!

Posted by Web Design on September 23, 2012 at 12:03 AM GMT+13:00 #

The layout is not working

Posted by guest on January 07, 2013 at 11:12 PM GMT+13:00 #

Not sure I understand your issues, can you please clarify?

cheers
James

Posted by guest on January 08, 2013 at 09:17 AM GMT+13:00 #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Discussions and Examples using Oracle Fusion Middleware. Some image links are broken when using Firefox, Safari, and Chrome. If you want to see the full image please use IE.

Twitter:@james8001

tumblr hit counter vistors, thanks for your support

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today