Oracle9iAS Portal Developer Kit
How to Build a External Application Portlet Using PDK-URL Services and MyYahoo


Once you have successfully installed and deployed the URL Services, you may want to begin building URL Services portlets of your own. When creating your own External Application portlet, it will access the same provider framework already used by the URL Samples. This feature limits the amount of  code required by you to create your portlet. What this means is that you only write code when you need implement changes to the default behavior. For example, to change the portlet body (show mode), simply create a new portlet, or alter an existing framework installed with the PDK Services for Java (PDK-Java).

This article describes how to build a basic External Application URL Services Portlet.

ASSUMPTIONS

You have already installed the samples downloaded with the most recent PDK-Java and and understand the steps required to display a URL Services Portlet on a Portal page. For more information on installing the sample, please review the article Installing the PDK-Java Framework and Samples. 

UPDATING FRAMEWORK

This section explains how to create an XML provider definition to describe and list your new portlet.  It then explains how to update the Oracle HTTP Server to view the new XML provider definition, i.e. provider.xml.

Creating an XML provider definition

In this section you will create a new XML provider definition. This will allow you add new portlets without affecting Web Providers already registered with Oracle9iAS Portal.

  1. Using your favorite text editor, create a new XML provider definition.

    You may use the sample below. All the changes that need to be carried out are highlighted in bold, i.e. replace with your own proxy/host/sample directory setting details.

    You must supply URL's for the portlets that you have created. The URL is added in the showPage, helpPage and aboutPage between the <pageurl> tags, doing this will provide the actual Portlet.

    Note: If you plan to add additional portlets in the future, verify that your portlet ID is unique for this provider.

<provider class="oracle.portal.provider.v1.http.DefaultURLProvider">

<session>true</session>

<authentication class="oracle.portal.provider.v1.http.CommonNodeHandler">

<authType>ExternalApp</authType>

<loginURL>http://login.yahoo.com/</loginURL>

<requestType>POST</requestType>

<userFieldName>login</userFieldName>

<userPwdName>passwd</userPwdName>

<fieldName>Submit</fieldName>

</authentication>

<proxyInfo class="oracle.portal.provider.v1.http.CommonNodeHandler">

<httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>

<httpProxyPort>80</httpProxyPort>

</proxyInfo>

<httpsProxyInfo class="oracle.portal.provider.v1.http.CommonNodeHandler">

<httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>

<httpProxyPort>80</httpProxyPort>

</httpsProxyInfo>

 

<portlet class="oracle.portal.provider.v1.http.PortletNodeHandler" version="1">

<id>2</id>

<name>Yahoo Weather Portlet</name>

<title>Yahoo Weather Portlet</title>

<description>This portlet is to test Integration services using weather.yahoo.com</description>

<timeout>100</timeout>

<timeoutMessage>yahoo timed out</timeoutMessage>

<showEdit>true</showEdit>

<showEditDefault>false</showEditDefault>

<showPreview>false</showPreview>

<showDetails>false</showDetails>

<hasHelp>false</hasHelp>

<hasAbout>false</hasAbout>

<acceptContentType>text/html</acceptContentType>

<registrationPortlet>false</registrationPortlet>

 

<renderer class="oracle.portal.provider.v1.RenderManager" >

 

<editPage class="oracle.portal.provider.v1.http.URLPageRenderer">

<contentType>text/html</contentType>

<accessControl>public</accessControl>

<pageUrl>http://edit.yahoo.com/config/set_wni?.src=yw&amp;.page=p1&amp;.done=http://weather.yahoo.com/</pageUrl>

<filterType>text/html</filterType>

<filter class="oracle.portal.provider.v1.http.HtmlFilter">

<useAuthLinks>false</useAuthLinks>

<baseHRef>http://weather.yahoo.com/</baseHRef>

</filter>

</editPage>

<showPage class="oracle.portal.provider.v1.http.URLPageRenderer">

<contentType>text/html</contentType>

<accessControl>public</accessControl>

<pageUrl>http://weather.yahoo.com/</pageUrl>

<filterType>text/html</filterType>

<filter class="oracle.portal.provider.v1.http.HtmlFilter">

<useAuthLinks>false</useAuthLinks>

<baseHRef>http://weather.yahoo.com/</baseHRef>

</filter>

</showPage>

</renderer>

 

<securityManager class="oracle.portal.provider.v1.http.URLSecurityManager">

<authorizType>public</authorizType>

</securityManager>

</portlet>

 

</provider>

  1. Save and close the file.  Make sure to name the file "provider.xml".

  2. Place the file in any directory other than the location where the PDK-Java provider.xml resides. 

    Remember the location.  For example:  C:\myyahoo\provider.xml

Notes: 

Updating the zone.properties

  1. Stop the Oracle HTTP Server.

  2. Open zone.properties.

  3. Under the Servlet Aliases section add the following:
    servlet.myyahoo.code=oracle.portal.provider.v1.http.HttpProvider
  4. Under the Aliased Servlet Init Parameters section, add the following:
    servlet.myyahoo.initArgs=provider_root=C:\myyahoo,sessiontimeout=1800000
  5. Save and close the file.

  6. Start the Oracle HTTP Server.

  7. Now, test that you can execute the Adapter by calling the newly added alias. For example, type in the URL:
    http://host.domain:port/servlet/myyahoo
  8. You should receive a sample page.

EXTERNAL APPLICATION

To ensure that you can access your individual My Yahoo page you will need to create a new External Application in Oracle Portal for the MyYahoo Portlet.

  1. In the "Application Name" box, type the name of the External Application as you want it to appear to the user (e.g., MyYahoo!)

  2. In the "Login URL" box, enter the URL for the login page of the External Application.  You can find this by going to the External Application login page, typing control-U to show the HTML source for page, and scrolling through the page until you find the login URL.  In the case of MyYahoo!, this value is
    http://login.yahoo.com

  3. In the "User Name/ID Field Name" box, type the name of the login field in the application Login page. You can obtain this from the Login page source as in step 2.  In the case of MyYahoo! the value of this field is login

  4. In the "Password Field Name" type the name of the password field in the application Login page.  You can obtain this field from the login page   source as in step 2.  In the case of MyYahoo! the value of this field is passwd

  5. Under "Authentication Method" specify whether the application uses GET or POST authentication. MyYahoo! uses   POST.

  6. "Additional Fields" may be required if the application submits additional fields with the login form. MyYahoo! needs six additional fields.

    Field Name

    Field Value
    Submit Sign in
     
  7. Once you have completed these steps, click "OK" to add the External Application.

 

VIEWING THE PORTLET

  1. Now that you have successfully tested your new alias.  You will need to register a new provider that calls this alias.

  2. Register your new Provider.

    1. Name:  MyYahooProvider

    2. Display Name:  My Yahoo Provider

    3. Provider ID: Leave blank, it will automatically be generated

    4. Timeout:  100

    5. Timeout Message:  My Yahoo  Portlet Timed Out

    6. Implementation Style:  Web

    7. Register on Remote Nodes: No

    8. Provider Login Frequency:  Once per User Session

    9. URL:  http://host.domain:port/servlet/myyahoo

    10. Check the following radio button: The user's identity needs to be mapped to a different name in the Web provider's application, and/or the Web provider requires an external application login for establishment of a browser session. If selecting this option, specify the external application ID below.

    11. Click on the list of values box next to the External Application ID. Select MyYahoo External Application

  3. Click on OK.

  4. Now add your new portlet to a page.  Take note to view the title and description.

Now that you have successfully built your own External Application portlet using URL services, please look for future articles that will guide you through adding services to your portlet such as session storage, NLS handling, customization etc. Review the following URL services articles for detailed information about the URL services architecture:


Revision History: