The most common way of using web services in an ADF JSF application 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. You can work in JDeveloper's IDE to quickly create a data control from a web service. You can also test the web service by running it on JDeveloper's integrated server, and running a page that consumes the data control.
Create a New Application and Project: Use the Create Application wizard to create a Java EE web application.
Create Java Classes: Create three Java classes containing bean attributes, constants, and a method.
Create an EJB Web Service: Create a session bean and a business method, then use the Create Java Web Service wizard to publish the bean and expose the method as a web service operation.
Create a Web Service Data Control: Use the Create Web Service Data Control wizard to generate the data control.
Create a JSF Page: Use the Create JSF Page dialog to create a starter page for adding UI components.
Add the Data Control to the Page: Use a series of drag-and-drop steps from the Data Controls panel in the Application Navigator to create databound UI components on your JSF page.
Set the Labels: Use the Property Inspector to set labels for some components.
The JDeveloper application is the highest level in the organizational structure. It stores information about the objects you are working with, while you are creating your application. It keeps track of your projects and the environment settings while you are developing. [ tell me more...]
Application templates provide you with a quick way to create the project structure for standard applications with the appropriate combination of technologies already specified. The new application created from the template appears in the Application Navigator already partitioned into tiered projects, with the associated technology scopes set in each project. [ tell me more...]
EJBModelas the name for the model project, and click Finish .
When you complete the steps for creating a new application and project, the Projects panel in the Application Navigator should look like this: [ tell me more...]
To follow along with the example, in this step and throughout the cards, enter values as shown in the instructions. Then you will be able to follow the steps in the cue cards exactly as written. [ tell me more...]
BatchOrderas the class name, and
oracle.model.freightas the package name. Accept the remaining defaults and click OK.
In the Create Java Class dialog, the name you specify in the Name field will become the file name for the class. The package name you enter in the Package field (or select from the Package Browser) will become the default package for subsequent Java classes that you create in the project. [ tell me more...]
The new Java class opens in the source editor. The generated code includes only the class and package that you specified: [ tell me more...]
When you complete the steps for creating three Java classes, the Application Navigator should look like this: [ tell me more...]
In JDeveloper's IDE, you can quickly create a session bean and create business methods declaratively. To begin creating a session bean, you will open the Create Session Bean wizard. To open the wizard, in the Application Navigator, right click a project and choose New . In the New Gallery, expand Business Tier and select EJB in the Categories tree and select Session Bean from the Items list, and click OK. [ tell me more...]
CalculateFreightas the EJB name. Make sure State less and Container are selected. Confirm that Generate Session Facade Methods is not selected. Click Next .
A session bean is a short-lived object containing business methods that can be executed by a client. In the example you are creating a stateless session bean that implements a CalculateFreightCost business method, hosted in an EJB container. [ tell me more...]
oracle.model.freightejb.CalculateFreightBeanas the bean class name, and click Next .
You can also launch the Create Java Web Service wizard from the New Gallery. In the Application Navigator, right-click the project and choose New . In the New Gallery, All Technologies page, select Web Services under Business Tier in the Categories tree and Java Web Service in the Items list, then click OK. [ tell me more...]
Generation completein the Web Services Log window.
After you create a web service, you will usually test it to ensure that you get the results you expect. JDeveloper's IDE allows you to deploy the web service to an integrated server for testing. [ tell me more...]
10in the batchId and orderedQuantity fields, respectively. Then enter
GOLDin the arg1 and arg2 fields, respectively. Click Send Request. You should see
18.0in the Response pane.
When you complete the steps for creating the web service using the wizard, the Application Navigator should look similar to this: [ tell me more...]
The most common way of using web services in an application 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. [ tell me more...]
DataControlas the project name and click Finish .
FreightCostas the data control name.
WSDL or web service description language, is a description language that defines how to communicate with a web service. When you use the Create Web Service Data Control wizard to generate a data control, you will need to reference the WSDL URL that JDeveloper automatically generated when you tested the web service in the integrated server. [ tell me more...]
When you complete the steps for creating the web service data control, the Application Navigator should look similar to this: [ tell me more...]
The JSF pages you create for your application can be JSP pages (which uses the file extension
.jsp) or JSP documents written in XML syntax (which uses the file extension
.jspx). Oracle recommends that when creating pages with ADF Faces components, you use XML-based JSP documents that use
.jspx rather than
.jsp files. [
tell me more...]
Libraries are provided for the various APIs and technologies installed with JDeveloper. These libraries are categorized as extension libraries, which are shared by all users of an install. [ tell me more...]
CalculateFreightCost.jspxas the file name.
When you complete the steps for creating a JSF page, the visual editor should look similar to this: [ tell me more...]
A data control is a representation of a business service, and comprises a hierarchical display of available business objects, including collections, attributes, and methods. [ tell me more...]
The Data Controls panel comprises a hierarchical display of available business objects, including collections, attributes, and methods. [ tell me more...]
When you complete the steps for adding the data control to the page, the visual editor should look similar to this: [ tell me more...]
Oracle ADF control hints provides a centralized mechanism for any JavaBeans-based business service data item to be rendered in a consistent manner across all client types. This mechanism, known as control hints, permits application developers to centralize certain UI settings across clients and thereby control many aspects of the way the UI interacts with the data item. Because the control hints are set at the level of the business service, it can also reduce the amount of UI coding. [ tell me more...]
Order Numberin the Label field and press Enter.
The file that defines the value for the control hints you set depends on the specific business service used for the project. In the case of beans-based business services, (including JavaBeans, Enterprise JavaBeans, and Oracle TopLink), by default JDeveloper generates a standard
.properties file for the project and saves the control hint definitions as translatable strings. [
tell me more...]
You can also use the Edit Attribute dialog to add ADF control hints. To open the Edit Attribute dialog, first you double-click the
.xml definition file (for example,
arg0.xml) in the Application Navigator to open the file in the default overview editor. [
tell me more...]
When you run the JSF page again, the page in the browser should look similar to this, with the new labels you added: [ tell me more...]
Copyright © 1997, 2009, Oracle. All rights reserved.