How to Develop/deploy SAP JSR 168 Portlet for JES-Portal - Part 1
Friday Feb 09, 2007
Article overview
This blog is the first in a series on « How-to » develop/deploy JSR168 Portlet for Java ES-Portal.
- This article ( Part 1 : How to develop/deploy SAP JSR168 Portlet for JES-Portal ) will enlighten the development environment recommended to create/test/deploy easily JSR168 portlet.
- The next article (Part 2: AJAXing JSR168 Portlet for JES-Portal) will focus on added values provided by AJAX/jMaki widgets.
Basically, for the purpose of a POC, I have been requested to demonstrate JSR168 portlet having access to SAP R/3 backend system (SAP R/3 Human Resources).
As far as SAP R/3 is concerned, there are a couple of samples developed by Sun microsystems consultants or Java ES-Portal Engineering team of such portlets. For a complete description of these SAP portlets, see « Sun Java System Portal Server Enterprise Application Integration Guide SAP R/3 4.7 » available here ( http://ps.sfbay.sun.com/docs/content/integrations/docs/EAI/Release/DeveloperGuide/SAP_EAI_Guide_V1.0.pdf ).
By the way, this POC was a good opportunity to explore mainly 2 directions :
-
What could be an ideal development environment for JES-Portal 7.* ?
-
Are there any added values to integrate AJAX/jMaki widgets into a JSR168 portlets
Part1 : How to develop/deploy JSR168 Portlet for JES-Portal
JSR168 portlet can be easily developed and tested with Sun Java Studio Creator 2 (http://developers.sun.com/prodtech/javatools/jscreator/index.jsp). Sun Java Studio Creator 2 provides a JSR168 portlet container (Pluto) available to test JSR168 portlets based applications without any deployment to Java ES Portal 7.* (at least during the development phase).
By the way, many users of the open source GlassFish Java EE 5 application server want to use the server when developing and testing portlets. Portlets are designed to run in the context of a portal, which GlassFish does not provide directly. Although it is possible to execute and test a portlet without a portal in deploying it on Glassfish within an Open Source Portlet Container :
-
Developing the portlet JSR 168 with Netbeans 5.5 with the Netbeans Plugin For Portlets and Sun Java Portal Server
-
Testing the portlet JSR 168 on Glassfish/ Open Source Portlet Container
-
Deploying the portlet JSR 168 on JES-Portal 7
The Portal Server open source project is derived from the Sun Java System Portal Server 7 product and will comprise of the following components and technologies: Portlet repository, JSR168 compliant portlet container, Web Services for Remote Portlets (WSRP) 1.0 based producer and consumer implementations, Portal aggregation and administration framework, Communities and collaboration framework/services, Full-text search engine with federated search and taxonomy capabilities, Secure remote access for SSL/VPN capabilities from outside the firewall and Multi-device mobile access capability to all portal content and applications.
The development environment looks like the following :

A/ Environment setup
Follow the standard instruction steps to set up
-
NetBeans5.5 with Glassfish or JES-Application Server 9PE
-
Open Source Portlet Container on Glassfish or JES-Application Server 9PE
-
JES-Portal Server (optional)
-
Setting up Glassfish
This article assumes that you have successfully installed GlassFish. If you do not have GlassFish, download it now.
-
Setting up Open Source Portlet Container
Right now the binary is not available on java.net as some legal review process is still going on for BCL. But internally you can get the latest stable installer binary for Open Source Container from
http://psre.red.iplanet.com/share/builds/portal/portlet-container/ships/(date).1/ps-solre1_SunOS5.9/
Download
: portlet-container-configurator.jar
The installation process is straightforward and can be found under : https://portlet-container.dev.java.net/public/GettingStarted.html
Use the following procedure to set up your GlassFish installation and prepare it for portlet deployment.
The
procedure uses the variable $GLASSFISH_HOME to represent
the directory in which GlassFish has been installed.
-
Save the
portlet-container-configurator.jarfile in the$GLASSFISH_HOMEdirectory. Then, open a command shell and expand the file with the following command.
java -jar $GLASSFISH_HOME/portlet-container-configurator.jar $GLASSFISH_HOME/ <DOMAIN_DIR>
-
Stop the server with the following command:
$GLASSFISH_HOME/bin/asadmin stop-domain domain1
-
Restart the server with the following command:
$GLASSFISH_HOME/bin/asadmin start-domain domain1
-
Setting up Netbeans Plugin For Portlets and Sun Java Portal Server
This section is an extract of the documentation available :
http://wikihome.sfbay.sun.com/portalserver/Wiki.jsp?page=OSPortletPluginDownload
We provide this extract in this article, as an easy way to read this article.
-
Download the Portal Plugin Pack
Generic Portlet Builder
OpenSource PC Plugin
Sun PS 7.x Plugin
Base PSFramework
-
Start Netbeans IDE.
-
Go to Tools > Update Center
-
Select "Install manually downloaded module"
-
Add the four .nbm files you just extracted in the previous steps ( e.g /tmp )
-
Click Next and follow the instructions to install these plugins.
-
Choose "Restart Now" to restart the IDE.
-
Plugin is now ready to use.
-
Please read Quick guide and known issues to use the portlet plugin (Mandatory)
B/ Development life cycle
-
SAP R/3 specific development steps
SAPGui can be used to have access to SAP R/3 in order to identify the BAPIs that should be used by the portlets.
Based on this information, the SAP Web Service Browser is used to export the BAPIs WSDL files from SAP R/3 repository.
-
Client Web Service application generation
With NetBeans5.5 it is straithforward to generate Client Web Service application. Some tutorials are available from the Netbeans website (http://www.javapassion.com/netbeans/masterindex.html)
It is strongly recommend to create a StandAlone client (main Java) to test the behavior of the Client Web Service application. As far as SAP R/3 is concerned, it is required to provide SAP Authentication parameters (username/password) within the SOAP message to be able to execute the BAPIs.
-
Portlet development with NetBeans5.5 plugin for OpenSource Portlet Container
The NetBeans5.5 plugin for OpenSource Portlet Container is used to create JSR 168 portlet Application.
Once the portlet has been developed, it can be tested immediatly into the Open Source Portlet Container deployed on Glassfish
-
Portlet test with Glassfish/OpenSource Portlet Container
The portlets can be tested immediately with the JSR168 portlet container.
-
Portlet deployment steps
When the portlet is ready to deploy, within NetBeans5.5, just switch you deployment target from Open Source Portlet Container to Java ES Portal7.*
C/ Sample developed during the POC : SAP R/3 NameFinder JSR168 portlet
|
This portlet can be used to search for people in the organization and retrieve their contact details. Searches can be done on the following criteria:
|
The screen shot below shows the search results page. The following details are available in the results:
|
|
|
|
Nothing very special. The main issues are related to SAP R/3 integration. You have to deal with SAP R/3 BAPIs exposed as WebServices. Some information about this topic are available here.
D/ Implementing the sorting mechanism with a standard approach
By the way, browsing the JSR168Portlet « SAP Namefinder - Results », it can be noticed some fancies features have been integrated such as a « sorting » mechanism. When you want to implement this sorting mechanism for the columns of the table returned by SAP R/3 you need a couple of Java statements. Right??? The JSP able to handle this sorting mechanism is about 600 lines of HTML + Java code. jMaki Dojo.Table widget simplifies a lot this development. This topic will be discuss in the 2nd part of this article « Part 2: AJAXing JSR168 Portlet for JES-Portal ».
E/ SAP R/3 integration
The SAP R/3 system exposes of a set of Business Application Programming Interface or BAPI to allow developer to integrate with the R/3 system. In R/3 version 4.7, every RFC-enabled BAPI is exposed as a Web Service. The list of the BAPIs exposed as Web service is available through a SAP Web Service Browser. Having access to this browser, you can download the WSDL and documentation of the selected BAPI.

Based on this WSDL, it is straighforward with NetBeans 5.5 to create a Web Service Client having access to SAP R/3 BAPI. and to create a standalone client to test the activation of this Web Service Client.
F/ JSR168 portlet deployment to Java ES Portal Server 7.*
So far, the JSR168 portlet has been deployed and tested through the OpenSource Portlet Container within Glassfish. You can manage the JSR168 portlet deployment from the Netbeans5.5 Plugin For Portlets and Sun Java Portal Server as follow:
Part2 : Ajaxing JSR168 Portlet for JES-Portal
The next time, I will blog about the added values of using AJAX libraries and jMaki widgets in JSR portlets.













comment
io