Skip Headers
Oracle® Application Server Portal Developer's Guide
10g Release 2 (10.1.2)
Part No. B14134-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

3 Building Portlets with OmniPortlet

OmniPortlet is a subcomponent of Oracle Application Server Portal that enables page designers and content contributors to easily publish data from different data sources using a variety of layouts. You can learn more about other portlet development tools in Chapter 2, "Portlet Technologies Matrix".

The OmniPortlet enables page designers and content contributors to:

OmniPortlet also supports proxy authentication, including support for global proxy authentication and per-user authentication. You can specify whether all users will automatically log in using a user name and password you provide, each user will log in using an individual user name and password, or all users will log in using a specified user name and password.

The OmniPortlet provider is installed as part of OracleAS Portal. You can upgrade to later releases of OmniPortlet from the product area on OTN (http://www.oracle.com/technology/products/ias/portal/index.html) as part of the Oracle Application Server Portal Developer Kit (PDK). Instructions for installing, configuring, and registering the OmniPortlet provider are provided within the pdksoftware.zip file containing the JPDK and Portal Tools.


Note:

You can find more information about developing portlets in Chapter 1, "Understanding Portlets", and information about providers and other portlet technologies in Chapter 2, "Portlet Technologies Matrix".

This chapter provides an overview of the OmniPortlet, then steps you through defining various types of OmniPortlets. It contains the following sections:

3.1 What is OmniPortlet?

OmniPortlet is specifically targeted at enabling page designers and developers to quickly and easily publish data from various data sources in a variety of layouts using a Web-based wizard. An OmniPortlet can be based on almost any kind of data source, such as a spreadsheet (comma-separated values), XML, and even application data from an existing Web page.

To display personalized data, you can refine the retrieved data by filtering the results returned from a data source, and parameterize the credential information used to access secure data. Out of the box, OmniPortlet provides the most common layout for portlets: tabular, chart, news, bulleted list, and form.

OmniPortlet is provided with Oracle Application Server 10g; you can add an OmniPortlet from the OracleAS Portal Repository in the Portlet Builders folder. If you've downloaded OmniPortlet as part of the Oracle Application Server Portal Developer Kit, you must register it before you can use it. To learn more about registering a Web provider, refer to the documentation on Portal Center. You can then add an OmniPortlet to any portal page.


Note:

You can find more information about building portal pages in the Oracle Application Server Portal User's Guide on Portal Center.

The OmniPortlet wizard contains six tabs. When you first define your OmniPortlet, you set the data source type, data source options, filter options, view options, and layout. When you've completed these steps of the wizard, you can re-enter the wizard by clicking the Edit Defaults icon on the Portal page. When you re-enter the wizard, you can change the definitions on the Source, Filter, View, and Layout tabs, as well as set up the events parameters on the Events tab.

This section provides a high-level overview of the six tabs (see the table below), as well as a detailed description of each tab. You can also find information in the online help (accessible by clicking the Help link in the product), which describes the options on each tab.

Table 3-1 Omniportlet Wizard

Tab Description
Type
Provides your data source options. Displays only in the initial definition of the portlet.
Source
Provides the options for the selected data source, such as the URL of the Web Service you wish to use.
Filter
Provides sorting options at the OracleAS Portal level to enable you to refine your results.
View
Provides options for displaying portlet header and footer text, the layout style, and caching.
Layout
Provides detailed options for customizing the layout.
Events
Provides options for adding events to the portlet. Displays only after the portlet has been defined in the Edit Defaults mode of the wizard.

3.1.1 Type

Figure 3-1 Type Tab of the OmniPortlet Wizard

Shows Type tab of OmniPortlet.
Description of the illustration pdg_omni_type.gif


Note:

If you've downloaded and installed an additional data source from Portal Center (http://portalcenter.oracle.com), the data source will display on the Type tab.

When you first launch the OmniPortlet, the Type tab displays, which enables you to choose your data source. Out of the box, OmniPortlet supports the following data sources:

Table 3-2 Supported Data Source Types

Data Source Type Description
Spreadsheet Displays data from a text file containing comma-separated values (CSV).
SQL Displays data from a database using SQL.
XML Displays data from an XML file.
Web Service Displays data from a discrete business service that can be accessed over the Internet using standard protocols.
Web Page Displays data based on existing Web content.

3.1.2 Source

After you've chosen your data source type, the Source tab of the OmniPortlet wizard displays. This tab adapts to the data source you've chosen, to enable you to specify the options offered by that data source. The top portion of the screen is dedicated to the specified source. If the OmniPortlet provider has been set up to use proxy authentication that requires your login, a Proxy Authentication section displays where you can enter this information.


Note:

The Proxy Authentication section only displays for the data sources that may require you to use a proxy server to access them: CSV (comma-separate values), XML, Web Service, and Web Page. For more information on configuring the OmniPortlet provider to use proxy authentication, see the online help topic that displays when you click Help on the Edit Providers: OmniPortlet Provider page.

Each Source tab, except for the Source tab for the Web Page data source, contains a Connection section, where you can define the connection information to access secured data, and a Portlet Parameters section, where you can define the parameters for the portlet. You can then map the portlet parameters to the page-level parameters.

Figure 3-2 Source Tab: Connection and Portlet Parameters Section

Shows Source tab of OmniPortlet.
Description of the illustration pdg_omni_connpara.gif

The following sections describe the portion of the Source tab specific to each data source.


Note:

For more information on the Source tab options, click Help in the upper right corner of the page.

3.1.2.1 Spreadsheet

Spreadsheets are a common method of storing small data sets. OmniPortlet enables you to share spreadsheets by supporting comma-separated values (CSV) as a data source. On the Source tab, you specify the location of the CSV file. If the file is located on a secure server, you can specify the connection information in the Connection section described above. You can also select the character set to use when OracleAS Portal reads the file.


Note:

Since the OmniPortlet provider exists and executes in a tier different than the OracleAS Portal application and does not have access to the OracleAS Portal session information, you must expose CSV files that are uploaded to OracleAS Portal as PUBLIC in order for OmniPortlet to access them.

Figure 3-3 Source Tab: Spreadsheet

Shows Spreadsheet source tab.
Description of the illustration pdg_omni_source_csv.gif

3.1.2.2 SQL

The relational database is the most common place to store data. OmniPortlet enables you to use standard JDBC drivers and provides out-of-the-box access to Oracle and any JDBC database. You can specify the driver type when you configure the connection information.


Note:

You can also use the DataDirect JDBC drivers to access other relational databases. To configure OmniPortlet to use these drivers, refer to "OmniPortlet: How to Use DataDirect JDBC Drivers" under Developer Services > OmniPortlet & Web Clipping on Portal Center (http://portalcenter.oracle.com).


Note:

For more information on using the SQL data source, refer to Defining a Portlet Based on a SQL Data Source.

3.1.2.3 XML

Although still a relatively new method of storing data, XML is increasingly used to control access to data sets over the intranet, and even the Internet. On the Source tab, you can specify the URL of the XML file that contains your data.

The specified XML file can either be in tabular (ROWSET/ROW) structure, or you can provide an XML Style Sheet (XSL) to transform the data. The following image shows an example of the ROWSET/ROW structure of an XML data source.

Figure 3-6 ROWSET/ROW Structure of an XML Data Source

Shows ROWSET/ROW structure.
Description of the illustration pdg_omni_source_xmlstruct.gif

In the above example, the <TEAM> tags delineate the rowset, and the <EMPLOYEE> tags delineate the rows.

Regardless of the format of the XML file, OmniPortlet automatically inspects the XML to determine the column names, which will then be used to define the layout. If you want to specify this information yourself, you can supply a URL to an XML schema that describes the data.

Similar to the other data sources, you can also specify the connection information for this data source, if the XML file is located on a secured server protected by HTTP Basic Authentication.


Note:

Since the OmniPortlet provider exists and executes in a different tier to OracleAS Portal and does not have access to the OracleAS Portal session information, you must expose XML files that are uploaded to OracleAS Portal as PUBLIC in order for OmniPortlet to access them.

3.1.2.4 Web Service

A Web Service is a discrete business service that can be programmatically accessed over the Internet using standard protocols, such as SOAP and HTTP. Web Services are non-platform and non-language specific, and are typically registered with a Web Service broker. When you find a Web Service you wish to use, you must obtain the URL to the WSDL (Web Service Description Language) file that describes the Web Service, specifies the methods that can be called, the expected parameters, and a description of the returned data.

OmniPortlet supports both types of Web Services (Document and RPC (Remote Procedure Calls)). Once a WSDL is supplied, it is parsed, and the available methods that can be called display on the Source tab.

Similar to the XML data source, OmniPortlet expects the Web Service data in ROWSET/ROW format, though you can also use an XSL file to transform the data. OmniPortlet inspects the WSDL to determine the column names, though you may also specify an XML schema to describe the returned data set.

If you are new to Web services, you may want to first review the New to Web Services guide on the Oracle Web Services Center (http://www.oracle.com/technology/tech/webservices/learner.html).


Note:

For more information on using the Web Service data source, refer to Defining a Portlet Based on a Web Service.

Figure 3-7 Source Tab: Web Service

Shows Web Service Source tab.
Description of the illustration pdg_omni_source_ws.gif

3.1.2.5 Web Page

OmniPortlet enables you to use existing Web content as a source of data to publish information to your portal. It provides and renders clipped Web content as a data source.

The Web Page data source extends the scope offered by the Web Clipping Portlet to include scraping functionality. It also supports the following features:

  • Navigation through various login mechanisms, including form- and JavaScript-based submission, and HTTP Basic and Digest Authentication with cookie-based session management.

  • Fuzzy matching of clippings. If a Web clipping gets reordered within the source page or if its character font, size, or style changes, it will still be identified correctly by the Web page data source and delivered as the portlet content.

  • Reuse of a wide range of Web content, including basic support of pages written with HTML 4.0.1 and JavaScript, retrieved through HTTP GET and POST (form submission).

All Web clipping definitions are stored persistently in the Oracle Application Server infrastructure database or on another Oracle database. Any secure information, such as passwords, is stored in encrypted form, according to the DES (Data Encryption Standard), using Oracle9i database encryption technology.

The Source tab of the OmniPortlet wizard enables you to launch the Web Clipping Studio by clicking the Select Web Page button. Once you launch the Web Clipping Studio, you can refer to the Oracle Application Server Web Clipping Online Help.


Note:

For more information on using the Web Page data source, refer to Defining a Portlet Based on an Existing Web Page.

3.1.3 Filter

After you've selected the data source and specified the data source options, you can further refine your data by using OmniPortlet's filtering options. To use filtering efficiently, it is better to refine the data as much as possible at the data source level (that is, on the Source tab), then use the options on the Filter tab to streamline the data. For example, if you are using a SQL data source, you could use a WHERE clause to return only specific data from the specified columns. In this case, you could skip the Filter tab and continue to the View page of the wizard. However, if there are no filtering options at the data source level, you can use the options on the Filter tab to sort your data.

3.1.4 View

Once you've specified the data and sorted it, you can choose the view options and layout for your OmniPortlet. The View tab enables you to add Header and Footer text, choose a Layout style that you can later refine on the Layout tab, and enable caching. You can choose from the following layouts:

  • tabular

  • chart

  • news

  • bullet

  • form


Note:

For more information on the different layout styles you can use with OmniPortlet, click Help in the upper right corner of the page.

3.1.5 Layout

The Layout tab changes depending on the Layout Style you chose on the View tab, and enables you to further customize the appearance of your portlet. OmniPortlet supports drill-down hyperlinks in the chart layout. That is, you can set up the chart so that when a user clicks on a specific part of the chart, an action occurs (for example, jump to another URL).

For the other layout styles, you can define each column to display in a specific format, such as plain text, HTML, an image, button, or field. For example, suppose you selected a data source that includes a URL to an image. To see this image, you can select Image for the display of this column. Each column can also be mapped to an action, similar to the behavior of chart hyperlinks.

The following layout styles are available with OmniPortlet:

3.1.5.1 Tabular Layout

Figure 3-11 Layout Tab: Tabular Style

Shows Layout tab for Tabular style.
Description of the illustration pdg_omni_lay_tab.gif

Once you've chosen the tabular style on the View tab, you can refine the layout on the Layout tab. Typically, you use the tabular layout if you have one or more columns of data that you want to display in a table. You can choose Plain to display all rows in the table without any background color, or Alternating to display a background color for every other row in the table.


Note:

You can control the background color of a portlet through the portal page style. For more information on using portal page styles, refer to the Oracle Application Server Portal User's Guide.

In the Column Layout section, you can choose which data columns to display in the portlet, then select a display format for the data. Here, you can set a column to display a hyperlink, so that a secondary Web page displays when the user clicks that column in the table. You can also specify whether the secondary Web page displays in a new window.

Figure 3-12 Example of an OmniPortlet Using a Tabular Layout

Shows example of portlet using tabular layout.
Description of the illustration pdg_omni_laytb_ex.gif


Note:

For more information on using the OmniPortlet wizard, click the Help link in the upper right corner of the Layout tab.

3.1.5.2 Chart Layout

You can use the chart layout to display your data graphically, as a bar, pie, or line chart. On the Layout tab, you select the chart style and the column layout. When you choose the column layout, you can choose the groups, or columns on which the labels will be based. The category defines the values that will be used to create the chart legend, and the value determines the relative size of the bars, lines, or slices in the chart. You can also select whether the sections of the chart should point to a hyperlink, and whether the targeted information should display in a new window.


Note:

To group the information in the chart, you must group the information at the data level (for example, in your SQL query statement). Also, if numeric values in a data source contain formatted strings, commas, or currency (for example, $32,789.00), they are considered to be text and ignored when the chart is generated. You can instead remove these formatting characters from numerical values so that they are correctly read.

Figure 3-14 Example of the Layout Tab for a Pie Chart Layout

Shows Layout tab for Pie Chart style.
Description of the illustration pdg_omni_lay_ch_pie.gif

You can also define chart hyperlinks so that each bar, pie section, or line, links to another Web page. For example, you can display a chart portlet and a report portlet on your portal page, then set up the chart hyperlink to display a row in the report that displays more detailed information about the selected data.

In Figure 3-15, you can see the results of the options selected on the Layout tab in the previous image. Below the chart, you can see that the category, which was Department on the Layout tab, is used for the legend.

Figure 3-15 Example of an OmniPortlet Using a Pie Chart Layout

Shows example of pie chart layout.
Description of the illustration pdg_omni_laychpie_ex.gif

3.1.5.3 News Layout

You can use the news layout to display links to articles with brief descriptions for each. You can use this layout to publish information in standard XML formats, such as RDF (Resource Description Framework) or RSS (RDF Site Summary) to your portal page. In the Column Layout section, you can add a heading that displays at the top of the portlet. You can also add a logo, or use the scrolling layout so that the user can view all the information in the portlet as it moves vertically. Here, also, you can enter a URL so that another Web page displays when the user clicks on specific data in the portlet. You can also specify whether the secondary Web page displays in a new window.


Note:

The News Layout Scroll type in OmniPortlet is supported on Microsoft Internet Explorer and Netscape 7.0.

Figure 3-17 Example of an OmniPortlet Using a News Layout

Shows example of portlet in a news layout.
Description of the illustration pdg_omni_laynw_ex.gif


Note:

For more information on using the OmniPortlet wizard, click the Help link in the upper right corner the Layout tab.

3.1.5.4 Bullet Layout

You can use the bullet layout to display your data in a bulleted list. The Layout tab provides a variety of different bullet and numbered bullet styles. In the Column Layout section, you can choose how the columns will display in the portlet, as well as whether a second Web page will display when the user clicks that column. You can also specify whether the second Web page displays in a new window.

Figure 3-19 Example of an OmniPortlet Using a Bullet Layout

Shows example of portlet with bullet style.
Description of the illustration pdg_omni_laybl_ex.gif


Note:

For more information on using the OmniPortlet wizard, click the Help link in the upper right corner the Layout tab.

3.1.5.5 Form Layout

You can use the form layout if you have data you want to display as labels or default values in a form, such as Name: <name>. You can then use the portlet parameters and events to pass data to the selected row.

You can also specify whether to display the target of a URL in a new window:

Figure 3-21 Open In New Window Checkbox

Shows the Open In New Window checkbox.
Description of the illustration pdg_omni_lay_fm_win.gif

Figure 3-22 Example of an OmniPortlet Using a Form Layout

Shows example of portlet using form style.
Description of the illustration pdg_omni_layfm_ex.gif


Note:

For more information on using the OmniPortlet wizard, click the Help link in the upper right corner the Layout tab

3.1.6 Edit Defaults mode

After you've created your OmniPortlet and returned to your Portal page, you can then click the Edit Defaults icon to re-enter the wizard. You'll notice that you can click the tabs (except for the Type tab) to directly access each page of the wizard. You can also access the Events tab through the Edit Defaults wizard, which is explained in the next section.

When you edit an OmniPortlet through the Edit Defaults mode, keep in mind the following notes:

  • A new mode, "none," is now the default setting for the Locale Personalization Level of OmniPortlet and the Simple Parameter form. This new mode indicates that, when you edit the portlet defaults through the Edit Defaults mode, the changes apply to all users, regardless of the current OracleAS Portal session language and the locale of your browser. For more information about these settings, refer to the "Configuring the OmniPortlet Provider" document included with the pdksoftware.zip file.

  • You can also customize the portlet at runtime by clicking the Customize link on the portlet. When you customize the portlet, a complete copy of the personalization object file is created. Since all properties are duplicated, subsequently modifying the portlet through Edit Defaults will not be reflected in the customized version of the portlet. To ensure the latest changes are made to the portlet, you must click Customize again (after the modifications through the Edit Defaults wizard are made), then select the Reset to Defaults option.

3.1.7 Events

On the Events tab in the Edit Defaults mode of the OmniPortlet wizard, you can identify event parameters based on the portlet parameters you selected on the Source tab.

Figure 3-23 Events Tab of the OmniPortlet Wizard

Shows Events tab of OmniPortlet wizard.
Description of the illustration pdg_omni_eventtab.gif

3.2 Parameters and Events

Out of the box, OmniPortlet can receive up to five parameters and raising up to three events. Each of the events can send one or more parameters. For example, you can set up a chart that displays the employees in a department. When the user clicks one piece of the chart (for example, a department name), an event is raised that sends a parameter to the page. The page may then pass a parameter to all the portlets on that page that display information about the employees. Then, all the portlets on the page display information about the employees in the selected department.


Note:

To learn how to use parameters and events with OmniPortlet, follow the steps in Using OmniPortlet. If you are comfortable with the provider.xml file, you can add more parameters and events by editing the file.

To set up parameters and events, you must first enable the page group to accept parameters and events. In Oracle Application Server 10g, parameters and events are by default enabled. Then, you set up each portlet to accept the necessary parameters, and raise the required events. After you've set up the portlet parameters, you can link the portlets together by setting up the page-level parameters and events. The steps to do this are described in detail later in this chapter.

3.2.1 Portlet Parameters and Events

Out of the box, you can define up to five portlet parameters for an OmniPortlet. You can do this:

  • On the Source tab of the wizard when you define the OmniPortlet

  • On the Source tab when you select Edit Defaults for the OmniPortlet

Figure 3-24 Source Tab: Portlet Parameters Section

Shows Portlet Parameters section of Source tab.
Description of the illustration pdg_omni_source_pp.gif

Parameter values determine what data is displayed in the portlet. You can also use a parameter to pass a value in a URL or to embed a value in the portlet text.


Note:

You can learn more about portlet parameters in the online help, which you can access by clicking the Help link on the Source tab in the OmniPortlet wizard. The online help describes portlet parameters in detail, and how to set them up for your OmniPortlet. You can also refer to the chapter in the Oracle Application Server Portal User's Guide.

You can set up each OmniPortlet to raise up to three events. Each event can pass up to three parameters. Each parameter can be a portlet parameter, such as Param1, or a data source column, such as Department_No. You set up events on the Events tab when you select Edit Defaults for the OmniPortlet

3.2.2 Page Parameters and Events

After you've set up the parameters and events for each OmniPortlet on a portal page, you can map the portlet parameters and events to other portlets on the same page. For more information on using page parameters and events, refer to the OracleAS Portal online help and the Oracle Application Server Portal User's Guide.

3.3 Using OmniPortlet

The following sections will show you how to create three types of OmniPortlets (SQL data source, Web Service data source, and Web Page data source). You will learn how to create and modify these OmniPortlets, as well as use portlet parameters and events and page parameters and events to add interactivity to your portal page.


Note:

To learn more about specific pages and tabs in OmniPortlet, click the Help link in the top right corner. The help topic describes the contents of the selected page or tab.

3.3.1 Adding an OmniPortlet to a Portal Page

In this section, you will learn how to add an OmniPortlet instance to your portal page.

To add an OmniPortlet instance to a page:

  1. In the Edit mode of the page where you want to add the OmniPortlet, click the Add Portlets icon.

  2. On the Add Portlets page, in the Available Portlets list, click the Portlet Builders link.

  3. Click the OmniPortlet link.

    If you cannot find this link, use the Search field to find OmniPortlet.

  4. Click OK. The new instance of OmniPortlet now displays on your portal page.

Figure 3-26 OmniPortlet Instance on a Portal Page

Shows instance of OmniPortlet on portal page.
Description of the illustration pdg_omni_define.gif

3.3.2 Defining a Portlet Based on a SQL Data Source

In this section, you'll learn how to use OmniPortlet to publish data from a database using a SQL statement.

To select the SQL data source for the portlet:

  1. In the new OmniPortlet instance, click the Define link.

  2. On the Type tab of the OmniPortlet wizard, you can choose the data source you wish to use. Select the SQL radio button, then click Next.

    Figure 3-27 Type Tab of the OmniPortlet Wizard

    Shows Type tab with SQL selected.
    Description of the illustration pdg_omni_tasksql_type.gif

  3. On the Source tab, set the connection information for your data source by clicking Edit Connection.

  4. On the Connection Information page, in the Connection Name field, enter HR_SCOTT, and make sure that the Make this named connection available to all users checkbox is selected.

  5. In the Username field, enter the login ID for the sample database: scott.

  6. In the Password field, enter the password for the user ID: tiger.

  7. In the Connection String field, enter the connection string for your database, for example: hostname:port:oracle_sid, where hostname is the location where the database is installed.

  8. Make sure Oracle-thin is selected from the Driver Name drop-down list, then click Test to make sure the connection information is correct.

    Figure 3-28 Connection Information for the HR Scott Connection

    Shows Connection information.
    Description of the illustration pdg_omni_tasksql_conninfo.gif


    Note:

    If the connection does not work, verify you've entered the information appropriate to your database, or contact your database administrator.

  9. Once the connection returns a Successful message, close the Test dialog box, then click OK.

    The new Connection Name now displays on the SQL Data Source: Source tab.

    Figure 3-29 Connection Name on SQL Data Source Tab

    Shows Connection Name for the SQL data source.
    Description of the illustration pdg_omni_tasksql_conname.gif

  10. In the Statement field, enter the following code:

    select dept.deptno "Dept No", dname "Department", sum(sal)
    "Salary" from emp,dept
    where emp.deptno = dept.deptno
    group by dname,dept.deptno
    
    
  11. Click Test to test the query against your data source, then click Close to close the Test dialog box.

    Figure 3-30 SQL Statement on the Source Tab

    Shows SQL statement on Source tab.
    Description of the illustration pdg_omni_tasksql_sqltxt.gif

  12. Once you've validated your query against the database, click Next.

  13. Since we've already sorted our data using our SQL statement, we do not need to set the conditions on the Filter tab.

    Click Next.

  14. On the View tab, in the Title field, enter Salary by Department.

  15. Click Next.

  16. In the Footer Text field, enter Data from a SQL data source.

    Figure 3-31 Header and Footer section of the View Tab

    Shows Header and Footer sections of View tab.
    Description of the illustration pdg_omni_tasksql_vwhdrftr.gif


    Note:

    In the Header Text and Footer Text fields, you can also enter HTML tags. For example, if you entered <i>Data from a SQL data source</i>, the text would display at runtime as Data from a SQL data source.

  17. On the Layout tab, leave the default Tabular definition selected and click Finish. The OmniPortlet displays the results from your SQL query on your portal page.

    Figure 3-32 Tabular Results from SQL Data Source

    Shows tabular results from SQL data source.
    Description of the illustration pdg_omni_tasksql_tab.gif

In this section, you learned how to use the OmniPortlet wizard to create a portlet that displays data from a SQL data source in a tabular layout. Follow the steps in the next section to learn how to modify the layout of your new OmniPortlet.

3.3.3 Defining a Portlet Based on a Web Service

In this section, you will learn how to build a portlet based on a Web Service. For the purposes of this example, you will use a Web service provided on the Oracle Technology Network (http://www.oracle.com/technology/index.html), but you can use any Web Service with OmniPortlet.

To create a portlet based on a Web Service:

  1. Follow the steps in Using OmniPortlet to add an instance of OmniPortlet to your portal page.

  2. In the Edit mode of your page, click the Define link in the new OmniPortlet instance.

  3. On the Type tab, select the Web Service radio button, then click Next.

  4. On the Source tab, set the definition location for the Web Service (WSDL).

    Enter the following in the WSDL URL field: http://otn.oracle.com/ws/oracle.otn.ws.scott.OTNDeptEmp?WSDL

    Figure 3-33 WSDL URL Field of the Source Tab

    Shows WSDL URL field the Web Services Source tab
  5. Click Show Methods to see what methods are available from this Web service.

  6. From the Available methods for this Web Service drop-down list, choose OTNDeptEmp.getEmpXML, then click Show Parameters to see what parameters this method accepts.


    Note:

    If you use a method that has parameters, the parameters will display in this section of the tab. You can enter a sample value for the parameter, then click Test to view the sample XML data, the SOAP response, and the SOAP Request.

    Figure 3-34 Web Service Methods Section of the Source Tab

    Shows Web Services Methods section.
    Description of the illustration pdg_omni_taskws_source_wsm.gif

  7. Click Next.

  8. On the Filter tab, you can restrict the data returned from the data source. In this example, since the Web Service returns all data from the EMP table, you will restrict the returned data to a single department.

    In the Conditions section, set DEPTNO = 20 by choosing:

    1. From the Column drop-down list, choose DEPTNO.

    2. From the Operator drop-down list, choose Equals.

    3. In the Value field, enter 20.

      Figure 3-35 Conditions Section of the Filter Tab

      Shows Conditions section on Filter tab.
      Description of the illustration pdg_omni_taskws_filter_cond.gif

  9. In the Order section, set the results to display in alphabetical order by employee name.

    Next to Order By, choose ENAME from the Column drop-down list, and make sure Ascending is selected in the Order drop-down list.

    Figure 3-36 Order Section of the Filter Tab

    Shows Order section of Filter tab.
    Description of the illustration pdg_omni_taskws_filter_order.gif

  10. Click Finish.

    Your new portlet should look like the following:

    Figure 3-37 Web Service Portlet on the Portal Page

    Shows Web Service portlet on Portal page.
    Description of the illustration pdg_omni_taskws_tab.gif

In this section, you learned how to create a portlet using a Web service as a data source, and how to use the options on the Filter tab of the OmniPortlet wizard to sort your data. In the next section, you learn how to add interactivity to your portal page by using parameters and events.

3.3.4 Defining a Portlet Based on an Existing Web Page

The steps in this section will show you how to add information from an existing Web page to your portal page. In this example, you will use information from the Oracle Web site (http://www.oracle.com).

To create a portlet using a Web page data source:

  1. Follow the steps in Using OmniPortlet to add an OmniPortlet instance to your portal page.

  2. In the Edit mode of your page, click the Define link in the new OmniPortlet instance.

  3. On the Type tab of the OmniPortlet wizard, select the Web Page radio button, then click Next.

  4. On the Source tab, click Select Web Page.

  5. On the Web Clipping Studio page that displays, enter http://www.oracle.com in the URL Location field.

  6. Click Start to display the Web Clipping Studio.

  7. On the home page, you can type a search string in the Search field. For this example, enter omniportlet, then click the Search icon.

    Figure 3-39 Searching for Information on the www.oracle.com Home Page

    Shows search for information using Web Clipping.
    Description of the illustration pdg_omni_taskwp_pcsearch.gif

  8. The Search result is displayed in the Web Clipping Studio. Click Section to divide the target Web page into its clippable sections.

    Figure 3-40 Sectioning the Target Web Page

    Shows sectioning target Web page.
    Description of the illustration pdg_omni_section.gif

  9. At the top left corner of the search results, click Choose to select the table that encloses the multiple search results.

    Figure 3-41 Choosing the Search Results

    Shows how to choose the search results.
    Description of the illustration pdg_omni_taskwp_clip.gif


    Note:

    In this example, you'll notice that you can select URLs as part of your Web clipping. In Oracle Application Server Portal 10.1.2 and later, the context of the application is maintained. So, for example, any images that display on the hyperlinked page will be maintained.

  10. After you've chosen the clipping, you can refine your data further by scraping the data, that is, selecting specific cells you wish to display in your portlet. Click Scrape.

    Figure 3-42 Scraping the Data in the Clipping

    Shows scraping data in Web Clipping Studio.
    Description of the illustration pdg_omni_taskwp_scrape.gif

  11. While in Scraping mode, you can identify the text pieces in the Web clipping by selecting the check boxes next to each item. You can repeat these items at the column level, row level, or table level. In this example, we want to show the title and the description of each resulting article from our search. We can repeat the title and description at the row level, so that each result returned by the search displays only the title and the description of every result. In general, you choose the text items in the first row that contains all the pieces you wish to repeat for each row.

    In this step, select the output you want by selecting the check boxes next to the items. In this case, we want to display the title of the article and its description.

    Figure 3-44 Selecting the Description

    Shows selecting description.
    Description of the illustration pdg_omni_seldesc.gif

  12. Change the name of the output to be more meaningful. The following image shows an example of the new names:

    Figure 3-45 Changing the Product Name

    Shows changing product name.
    Description of the illustration pdg_omni_taskwp_pnfld.gif

  13. After you've defined the base unit of the repeating rows (in this case, the article title and description), you can now specify the repeat level. In the Data section, if you select one or more cells in the first row of a table, you can choose to repeat the selected cells at the row, column, or table level. When you click the More button, check boxes in all the cells in the row of the base unit (in this case, the article titled OmniPortlet: How to use Oracle9i XDB using the XML data source) are highlighted to identify the repeating group.


    Note:

    The check boxes you have manually selected (when choosing the title and description) have a white background, while the check boxes you selected using the More button have a grey (or highlighted) background.

    By clicking the More button, you can see that you have activated the repeating action, starting with the column level (notice that all the columns in the first row are highlighted with the first click of the More button). As you click the More and Less buttons, you can see how the highlighted check box positions change to identify all the repeating possibilities. You may have to click the More and Less buttons several times to find the correct repeating pattern for the data you wish to display.

  14. In this example, click the More button once to change the repeating level to row. Now, you will see that, for the first row, the article title and description are still selected (as indicated with the selected check boxes with a white background). In the subsequent rows, the article title and description are now also selected (as indicated with the selected check boxes with a grey background), which shows that the repeating level is at the row level.

    Figure 3-47 Highlighted Check Boxes at the Row Level (Title)

    Shows highlighted checkbox at row level using More.
    Description of the illustration pdg_omni_taskwp_hllt.gif

    Figure 3-48 Highlighted Check Boxes at the Row Level (Description)

    Shows highlighted check boxes at Row level.
    Description of the illustration pdg_omni_hlltdesc.gif

  15. Click the Continue icon.

  16. In the Clipping Attributes section, you can update the title and description of this portlet, so that users can see what clipped information this portlet contains. You can also change the connection time out, or the length of time in seconds, that the portlet will wait to establish a connection to the content source of the Web clipping.


    Note:

    For more information on using the Web Clipping Studio, click the Help icon in the upper right-hand corner to view the online help.

    In the Title field, enter OmniPortlet Articles.

  17. In the Description field, enter Display all articles regarding OmniPortlet on oracle.com.

  18. In the Time Out (seconds) field, enter 60.

    The Clipping Attributes section of the Web Clipping Studio should now look like the following image:

    Figure 3-50 Clipping Attributes Section of the Web Clipping Studio

    Shows Clipping Attributes section.
    Description of the illustration pdg_omni_taskwp_clipatt.gif

  19. Click OK.

  20. On the Source tab of the OmniPortlet wizard, the new title and description now display. To edit the Web clipping in the Web Clipping Studio, you can click the Select Web Page button again.

    Click Finish.

  21. Your new Web Page portlet displays on the portal page, and should look like the following image.

    Figure 3-51 Portlet Based on Existing Web Page Content

    Shows portlet based on existing Web Page.
    Description of the illustration pdg_omni_taskwp_wcport.gif

3.3.5 Modifying the Layout of an Existing OmniPortlet

After you've created a portlet, you may want to modify its appearance. With OmniPortlet, you can do so using its reentrant wizard.

In this section, you will learn how to modify the layout of the portlet you created in the previous section.

To modify the OmniPortlet layout:

  1. In the Edit mode of the page where you added the OmniPortlet, click the Edit Defaults icon in the OmniPortlet.


    Note:

    When you modify your OmniPortlet using the Edit Defaults mode, the changes may not appear in the Show mode of the portlet if you or the end user have already customized the portlet. If you do modify the portlet in the Edit Defaults mode, your end user must select the Reset to Defaults option on the Customize page in order for the Edit Defaults changes to appear.

  2. You can modify various aspects of your OmniPortlet in the Edit Defaults mode, by clicking on the desired tab.

    To change the layout, first click the View tab.

  3. Under Layout Style, select the Chart radio button, then click the Layout tab to modify the layout definition.

    Figure 3-52 Layout Style Section of the View Tab

    Shows Layout style section of View tab.
    Description of the illustration pdg_omni_taskmod_vwlay.gif

  4. On the Layout tab, in the Chart Style section, select the Pie radio button to display a pie chart, then choose Bottom from the Legend drop-down list to display the chart's legend below the pie chart.

    Figure 3-53 Chart Style Section of the Layout Tab

    Shows Chart style section of Layout tab.
    Description of the illustration pdg_omni_taskmod_lay_ch.gif

  5. In the Column Layout section, select the columns to hide or display.

    From the Group drop-down list, choose <None> and leave the other columns as they are.

    Figure 3-54 Column Layout Section of the Layout Tab

    Shows column layout section of Layout tab.
    Description of the illustration pdg_omni_taskmod_lay_col.gif

  6. Click OK to accept your changes and return to your portal page.

    Your new SQL portlet should look like the following:

    Figure 3-55 SQL Data Source OmniPortlet Displaying as a Pie Chart

    Shows SQL OmniPortlet displaying as pie chart.
    Description of the illustration pdg_omni_taskmod_pie.gif

    In this section, you learned how to return to the OmniPortlet wizard to modify the layout of your portlet, and to change the layout of your portlet from a tabular report to a pie chart.

3.3.6 Using Parameters and Events

Page parameters are used to pass values to a page and to the portlets on the page. The portlets that are configured to accept page parameters can trigger another action, depending on the contextual wiring of the parameters and events. For example, you could set up a page that displays a portlet that displays a stock ticker and a portlet that displays news about a particular company. A page parameter could then accept the stock symbol as a value, then display the relevant stock and news information in the appropriate portlets.

You can use parameters in your pages only if the Enable Parameters and Events page group setting is enabled. For information on enabling parameters and events in a page group, refer to the Oracle Application Server Portal User's Guide, Chapter 4, ÒWorking with Page Groups,Ó located on the Documentation page on Portal Center (http://portalcenter.oracle.com).


Note:

For more information on page parameters and events, refer to the Oracle Application Server Portal User's Guide, Chapter 7, Section 11, ÒUsing Parameters and Events.Ó

In this section, you will learn how to configure your page to support page parameters and events. You will then set up portlet parameters and events, then integrate them with your page parameters and events.

At the end of this section, the end user will be able to click a section of the pie chart that you created in Modifying the Layout of an Existing OmniPortlet. This action will display information about the selected department in the Web Service portlet you created in Defining a Portlet Based on a Web Service.

3.3.6.1 Adding Parameters to an Existing OmniPortlet

The steps in this section will show you how to add parameters to the Web Service portlet you created in Defining a Portlet Based on a Web Service.

To configure the OmniPortlet to accept parameters:

  1. While you're in the Edit mode of your portal page, click the Edit Defaults icon in the upper left-hand corner of the Web service portlet.

    Figure 3-56 Edit Defaults Icon for the Web Service Portlet

    Shows Edit defaults icon for portlet.
    Description of the illustration pdg_omni_taskpe_ed.gif

  2. On the Source tab that displays, locate the Portlet Parameters section, then set the following parameters:

  3. At the top of the screen, click the Filter tab.

  4. Change the existing condition to:

    DEPTNO Equals ##Param1##

    Figure 3-58 Condition Section of the Filter Tab

    Shows Condition section with condition value.
    Description of the illustration pdg_omni_taskpe_filter.gif


    Note:

    By changing the value to ##Param1##, you set the portlet to use the value of Param1 (which you created on the Source tab) for the value of the DEPTNO column. For example, if Param1 is 10, then DEPTNO is set to 10.

  5. Click the View tab.

  6. Add text to the portlet header that updates according to the selected department.

    In the Header and Footer Text section, in the Header Text field, enter the following:

    List of employees of the ##Param2## department.

    Figure 3-59 Header and Footer Section of the View Tab

    Shows Header and Footer section of View tab.
    Description of the illustration pdg_omni_taskpe_view.gif

  7. Click OK to save your changes to the Web service portlet.

In this section, you learned how to set portlet parameters, which you then integrated into the functionality of the portlet. Instead of simply showing the data for Department 20, portlet will display the information for the department number indicated in the parameter you used, and the header text will be updated according to the department indicated in the second parameter you used. After you set up the events for the SQL data source portlet, you will map page parameters to the portlet parameters you created in this section.

The next section will show you how to add events to the SQL portlet you created in Defining a Portlet Based on a SQL Data Source. Then, after you've set up the events, you will configure the parameters and events to work together on the portal page.

3.3.6.2 Adding Events to an Existing OmniPortlet

The steps in this section will show you how to raise an event when a parameter is set in another portlet on the same page.

To set up events in a portlet:

  1. While the page is in Edit mode, click the Edit Defaults icon in the upper left-hand corner of the Salary by Departments portlet (that displays the pie chart).

  2. Click the Layout tab.

  3. In the Chart Drilldown section, choose Event1 from the Action drop-down list, so that when a user clicks a section of the pie chart, Event1 occurs.

  4. Click the Events tab.

  5. Under ÒWhen Event1 is raised, pass:Ó, set the following options:

In this section, you set up your SQL OmniPortlet to raise an event when the user clicks on a piece of the pie chart. Once the user clicks the piece, OmniPortlet retrieves the number and name for the selected department, and passes that information to the two event parameters (Event1Param1 and Event1Param2).

In the next section, you will set up the parameters you created in Adding Parameters to an Existing OmniPortlet and the events you created in this section to behave together on your portal page by mapping them to page parameters and events.

3.3.6.3 Relating Portlet Parameters and Events on a Page

After you've created the parameters for the portlet that will control the data being passed, and set the event for the portlet that will control the data being passed, you must set the page parameters and events to relate the two portlets together on your portal page.

The steps in this section will show you how to set up the parameters at the page level, so that the parameters set in the Web Service portlet are passed to the SQL portlet, and then raise the appropriate event.

To set the page parameters and events:

  1. While you are in the Edit mode of your page, click the Page : Properties link in the upper left-hand corner of your page.

    Figure 3-61 Page: Properties Link Located Next to the Page Group: Properties Link

    Shows Page:Properties link.
    Description of the illustration pdg_omni_taskpe_pgp.gif

  2. Click the Parameters tab.

  3. In the New Page Parameter section, in the Parameter Name field, enter dept_no, then click Add.

  4. In the Page Parameter Properties section, next to the new dept_no parameter, enter Department Number in the Display Name field, and 20 in the Default Value field.

  5. Follow the previous two steps to create a second page parameter called dept_name, and set the Display Name to Department Name, and the Default Value to RESEARCH.

    Figure 3-62 Page Parameter Properties Section of the Parameters Tab

    Shows Page Parameter Properties section.
    Description of the illustration pdg_omni_taskpe_param.gif

  6. In the Portlet Parameter Values section, find the Web service portlet you created that contains the portlet parameters. If you created a new page specifically for the steps in this chapter, this portlet is the second instance of portlet: OmniPortlet in the list.

    Click the arrow to the left of portlet: OmniPortlet to display the Portlet Parameters for that portlet.

  7. Next to Param1, choose Page Parameter from the drop-down list, then choose Department Number from the drop-down list that displays.

    The portlet parameter Param1 is now mapped to the dept_no page parameter you created in the previous steps.

  8. Map the Param2 portlet parameter to the Department Name page parameter.

    Figure 3-63 Portlet Parameter Values Section of the Parameters Tab for the Page

    Shows Portlet Parameter values section.
    Description of the illustration pdg_omni_taskpe_param_ppv.gif


    Note:

    Now, the portlet parameters you created for the Web service portlet in Adding Parameters to an Existing OmniPortlet are mapped to page-level parameters called dept_no (Department Number) and dept_name (Department Name).

  9. Click the Events tab at the top of the screen.

  10. Click the first instance of portlets: Omniportlet.

  11. Make sure Event1 is highlighted under portlets: Omniportlet.

  12. Under When this event is raised, make sure Go to Page is selected, then click the List icon next to the drop-down list.

  13. Find your page name in the list, then click the Return Object link next to its name.

    Your page name now displays in the "Go to page" list.

    Figure 3-64 Setting Portlet Event1 to Display Your Portal Page

    Shows setting Portlet Event1 to display page.
    Description of the illustration pdg_omni_taskpe_event_set.gif

  14. When you select your portal page, the page parameters display in the Page Input section.

    Next to Department Number, choose Event Output from the drop-down list, then choose Event1Param1 from the drop-down list that displays. You have now set the Department Number page parameter to display the contents of Event Parameter 1.

  15. Set the Department Name page parameter to display the contents of Event Parameter 2.

    The Page Input section should now look like the following image.


    Note:

    Now, the event parameters you created in Adding Events to an Existing OmniPortlet for the SQL data source portlet are mapped to the page parameters, which are linked to the portlet parameters. Thus, the two portlets on your page are now linked and interactive.

    Figure 3-65 Page Input Section of the Event Tab for the Portal Page

    Shows Page Input Section of Event tab.
    Description of the illustration pdg_omni_taskpe_pageinput.gif

  16. Click OK to accept your changes.

  17. Test your changes by clicking on a piece of the pie chart. When you click the Accounting section, for example, the Web service portlet automatically updates with the information for the Accounting department.

In this section, you learned how to use page parameters and events to link your portlets together on a single portal page.

3.4 Summary

In this chapter, you learned how to use OmniPortlet to build various types of portlets on a page. You also learned how to use parameters and events to integrate portlets on a page and create a portal application.

You can find more information about using the various tools in OmniPortlet by clicking the Help link on each of the pages in the wizard. For more information on using Web Clipping, refer to Chapter 4, "Building Content-Based Portlets with Web Clipping".