« A Guide to JDeveloper and ADF at Oracle Open World and Oracle Develop | Main | Oracle ADF at Silicon Valley Code Camp - This Weekend »

Web Services with Complex Data Types in ADF 11g

A guest post by Srikant Subramaniam from our Fusion Middleware for Apps product management group.

The Web Service Data Control

The Web Service Data Control in ADF 11g provides an easy and convenient interface to incorporate web services in an ADF application. The data control abstracts the implementation of a business service (such as a web service) thus providing a consistent mechanism for the ADF pages to access the data.

While most of the simple samples out there will show you how to invoke a Web service that returns a simple string, there are some specific things you need to know when you are working with complex data types.

Complex Data Types

A complex data type wraps a number of attributes, such as an array of objects. For instance, the request object for the "getObject" operation contains an array of individual attributes as shown below:

snap001.jpg

Similarly, the response object can also contain several individual attributes:

snap-0107.gif

In JDeveloper 10.1.3 there was no out-of-the-box support for complex data types, hence the inability to drag and drop only the relevant input/output attributes onto the JSF page when designing the ADF UI.
As a result, we had the following workarounds:
1. For complex input parameters, create an instance of the complex input type in a managed bean and add it to the parameter map of an Oracle ADF operation binding that invoked the web service, as described here.
2. For complex return types, either via the use of web service data control; or a web service proxy, as described here.
While these workarounds were fully functional, they introduced the need for custom Java coding/development.

This has changed with JDeveloper and ADF 11g, and complex data types are now supported out-of-the-box, creating an ADF client does not require any custom Java coding and is accomplished via drag/drop style data binding of the complex data types.

This tutorial shows how to build an ADF 11g client using complex data types.

Comments (4)

Andreja:

I have a problem. When I drag return attribute to the page then web service is called on page load.

shay:

Andreja,
You'll need to check the refresh condition assign to the WS execution in the page binding.
This solution might help:
http://blogs.oracle.com/shay/2009/01/preventing_queries_when_page_f.html

anyone:

Hi Shay,
from an architecture point of view I would never use the WS-DataCorntol directly. I suggest to use a WS-ClientProxy generator like CXF, AXIS, Oracle, ... and use the POJO-Datacontroll. If you connect the DC directly against WS you can't use all WS-standards like, SAML with Kerberos, WS-Adressing, WS-Reliability etc.
Furthermore, in a more complex szenario we found a lot of pitfalls where we was unable to solve with the current WS-DC implementation.

- che

shay:

Che,

I agree that using the Java client proxy generation capability in JDeveloper to create a Java class that invokes the Web service, and then expose that class as a data control is potentially a more powerful and flexible combination.
But sometime the quick and dirty way that the Web service data control offers is a good enough solution.

Shay

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)