Sunday, April 5, 2009

XML Access Script - WebSphere Portal

XMLAccess is a command-line batch-processing utility that is incredibly useful for exporting and importing various portal configurations. It can be used for backing up the configuration of certain environments, for loading new configurations (for new portlets or pages, for example), or for updating existing portlets when a new WAR file is provided by development. Perhaps most important, this tool greatly eases the duplication of a portal environment from server "A" to server "B."

XMLAccess connects to the portal configuration URL over HTTP (usually something like: http://myhost:10038/wps/config

The syntax for the command is as follows:
1. Command for Base portalxmlaccess -user wpsadmin -pwd itso -in file.xml -out result.xml -url myhost:10038/wps/config

2. Command for Virtual portal
xmlaccess -user wpsadmin -pwd itso -in input.xml -out output.xml -url myhost:10038/wps/config/

In the command line, use the following file names:
• input.xml: The name of a file containing the XML request (configuration export or update) that should be processed.
• output.xml: The name of the result file containing the XML output/error (configuration export).
• url: The URL to access the Portal configuration servlet. This URL consists of the Portal host name, the base Uniform Resource Identifier for the Portal, as specified during installation (for example /wps), the servlet extension /config and the virtual portal name.

You can use the XMLAccess tool to transfer a complete configuration, including:
• Portlets
• Access Control List
• Portal Web application configurations (portlet applications)
• Portal skin definitions
• Portal theme definitions
• Portal portlet configurations
• Portal site map (pages, labels, and links)
• Portal URL mappings
• Creation of clones/instances
• Deployment of war files
• Create the virtual portal

Basic Examples:




1. Deployment of war file:


file:///$server_root$/installableApps/StdWorldClock.war

name="StdWorldClock" >



update="set"/>







2. Adding portlet on page





portletref=" id.com.portlet.worldclock"/>





3. Create page/Label/URL, Access control and URL mapping
> For label: type=”label”
> For Page : type=”page”





Welcome



> URL: there are 2 types of URLS
External URL
Internal URL

http:yahoo.com

External Link to Yahoo


Internal URL:

4. URL mapping : Create theURL mapping in the specified virtual portal.






5. Install theme and skin
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_1.3.xsd"
type="update"
create-oids="true">

uniquename="ibm.portal.skin.TestPortal" resourceroot="TestPortal">

TestPortal
TestPortal Skin


uniquename="ibm.portal.skin.NoSkin" resourceroot="NoSkin">

No Skin
NoSkin


uniquename="ibm.portal.theme.TestPortal" resourceroot="TestPortal">

TestPortal
TestPortal Theme