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.
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.
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.
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.
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&.page=p1&.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>
Save and close the file. Make sure to name the file "provider.xml".
Remember the location. For example: C:\myyahoo\provider.xml
Notes:
Stop the Oracle HTTP Server.
Open zone.properties.
servlet.myyahoo.code=oracle.portal.provider.v1.http.HttpProvider
servlet.myyahoo.initArgs=provider_root=C:\myyahoo,sessiontimeout=1800000
Save and close the file.
Start the Oracle HTTP Server.
http://host.domain:port/servlet/myyahoo
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.
In the "Application Name" box, type the name of the External Application as you want it to appear to the user (e.g., MyYahoo!)
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
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.
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.
Under "Authentication Method" specify whether the application uses GET or POST authentication. MyYahoo! uses POST.
"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 |
Now that you have successfully tested your new alias. You will need to register a new provider that calls this alias.
Register your new Provider.
Name: MyYahooProvider
Display Name: My Yahoo Provider
Provider ID: Leave blank, it will automatically be generated
Timeout: 100
Timeout Message: My Yahoo Portlet Timed Out
Implementation Style: Web
Register on Remote Nodes: No
Provider Login Frequency: Once per User Session
URL: http://host.domain:port/servlet/myyahoo
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.
Click on the list of values box next to the External Application ID. Select MyYahoo External Application
Click on OK.
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:
April 19, 2001.