Portal Express, Version 6.0
Operating systems: i5/OS, Linux, Windows
Work with the XML configuration interface
- Overview
- Terminology
- Using the XML configuration interface
- XML configuration through administrative portlets
- The XML configuration command line client and its syntax
- Syntax elements of the XML configuration interface
- XML Syntax for using a secure connection with SSL
- XML Syntax for exporting and importing credential vault data
- XML input and output
- Transfer a complete configuration
- Staging - transferring a release configuration
- Exporting and transferring parts of a portal configuration
- Creating and modifying resources
- Activating and deactivating portlets, portlet applications, and Web applications
- Scheduling the delayed cleanup of portal pages
- Registering predeployed portlets
- Deregistering users and groups
- Preparing the deletion of orphaned data
Overview
You can use the XML configuration interface to export and import configurations.
XML configuration interface results are influenced by property settings in the configuration services.
Several sample files are available for different purposes of portal configuration using XML. These sample files are documented here for reference purposes only. To use the XML samples for work on the portal configuration, use the files provided in the portal installation, as they might be more up to date than this documentation. The XML sample files are located in...
Linux: portal_server_root/doc/xml-samples i5/OS: portal_server_root/doc/xml-samples Windows: portal_server_root\doc\xml-samples
Use the XML configuration interface
There are two ways to work with portal configuration data:
- XML configuration command line client
- Administration portlets
The XML configuration command line client provides all the XML configuration interface functions. XML configuration through administrative portlets allows you to export and import configurations.
XML configuration through administrative portlets
XML configuration through administrative portlets allows you to export and import configurations. You can export a page or an entire page hierarchy by clicking the Export icon in the Manage pages administration portlet. You can also import any XML configuration file using the Import XML portlet.
To export a page or an entire page hierarchy using the Manage pages portlet:
- On the Manage Pages portlet, click the export button for a specific page.
- You are then asked if you want to export the entire page hierarchy or only the selected page. Proceed as follows.
- Click Yes to export the entire page hierarchy.
- Click No to only export the selected page.
- Click Cancel to stop the page export.
- If you selected Yes or No you are prompted to save the configuration file. Provide a file name and select the location where you want it saved.
- When the export is complete you see a success message.
- Check the content of the saved XML configuration file to make sure that a <failure> tag does not exist. On the Download complete screen, click Open to view the newly saved XML file. If you do not want to view the XML file, close the extra window that is open for viewing the file.
To import an XML configuration file using the Import XML portlet:
- On the Import XML portlet, locate the xml configuration file that you want to import. Use the browse button to help locate the file.
- Click Import to import the configuration.
- When the import is complete you see a success message.
The XML configuration command line client
The command line client can be invoked by running...
./xmlaccess.sh|batThe basic syntax is...
xmlaccess -user user_ID -password password -url myhost:10038/wps/config -in input_file.xml -out result_file.xmlThe command line client is contained in the file wp.xml.client.jar in...
Linux: portal_server_root/bin i5/OS: portal_server_root/bin Windows: portal_server_root\bin
You also need the file wp.base.jar. It is located in...
Linux: portal_server_root/shared/app i5/OS: portal_server_root/shared/app Windows: portal_server_root\shared\app
Connecting to a remote server makes it possible to configure the portal remotely. Copy the three required files to the remote machine and configure the portal from there. All you need is a Java runtime. However, you have to adapt the path settings in the shell scripts accordingly.
All data, including the user ID and password, are sent to the server unencrypted. Use an HTTP connection to connect to the XML configuration interface only from inside a protected intranet where you can be sure that the HTTP connection is not compromised. In all other networks use a secure HTTPS connection to connect to the XML configuration interface.
If you install PK28148 in the portal Version 6.0, you can use the parameter...
askForCredential...and leave out the parameters user and password. The XML configuration interface will then prompt you for the user ID and password. This can be useful in security sensitive environments, as the user credentials are not visible on the console or in the process view.
xmlaccess -askForCredential -url myhost:9081/wps/config -in input_file.xml -out result_file.xmlFor Version 6.0.1 and later, if you leave out the user and password parameters, the XML configuration interface will prompt you for the user credentials.
To access a virtual portal...
xmlaccess -user user_ID -password password -url myhost:10038/wps/config/URL_mapping_context_of_the_VP -in input_file.xml -out result_file.xmlFor the URL Mapping context use the mapping that you specified when you created the virtual portal.
Syntax elements of the XML configuration interface
Syntax Description xmlaccess The is the shell script. Use one of the following scripts:
Linux: ./xmlaccess.sh i5/OS: xmlaccess.sh Windows: xmlaccess.bat
-in Name of a file containing the XML request (configuration export or update) that should be processed. -user
-passwordUser identification and password describing the authority under which the request should be processed. For the value for user specify the short username as specified during login; full distinguished names (DN) are not supported. The XML configuration interface is only accessible to users that have the manager role on the virtual resource XML_ACCESS and the administrator role on the virtual resource PORTAL.
-askForCredential If you install PK28148, you can use the parameter askForCredential and leave out the parameters user and password. The XML configuration interface will then prompt you for the user ID and password. The parameter askForCredential requires no value to be specified.
-url URL to access the configuration servlet. This URL consists of the host name, the base URI as specified during installation (for example /wps), and the servlet extension /config.
-out Name of the result file that contains the XML output. This file gives a result status and thereby indicates whether the XML request was performed successfully, or what errors might have occurred. In the case of an XML export, this file contains the exported configuration. You can later use this file to re-import the exported configuration.
XML Syntax for using a secure connection with SSL
When you use the XML command line client with SSL over a secure HTTPS connection, the command syntax is as follows:
xmlaccess -user user_ID -password password -url https://myhost:9444/wps/config/ -in input_file.xml -out result_file.xml -truststore trustStore -trustpwd trustPassword -trusttype trustType [ -keystore keyStore -keypwd keyPassword -keytype keyType ]The https:// prefix in the URL is required. The appropriate HTTPS port must be provided instead of the HTTP port.
The trust* options are mandatory in configurations where a custom certificate store is used, and optional for configurations that use the Java standard cacerts certificate store.
The options starting with the string key are optional.
They are only required when client certificate authentication is used for establishing the SSL connection.
The default value for -keyType and -trustType is jks. Therefore the -keytype and -trusttype options are optional unless the used keystore or truststore uses a different format.
XML Syntax elements for using a secure connection with SSL
Syntax Description -trustStore Use this element to specify the name of the truststore file that contains the server certificates that are required for accepting SSL connections with trusted servers. If no truststore is provided, the XML client will use the default Java cacerts truststore. -trustPassword Use this element to specify the password that is required for accessing the truststore. If the default Java cacerts truststore is used, no trustPassword needs to be provided. -trustType Use this element to specify the type of the truststore that is used. The default type is jks. As long as the used truststore is of type jks, you do not have to provide this parameter.
-keyStore Use this element to specify the name of the keystore file that contains client certificates that are required for establishing an SSL connection with a server that requires client certificate authentication. If no keystore is provided, the XML client will use the default Java cacerts keystore. -keyPassword Use this element to specify the password that is required for accessing the keystore. If the default Java cacerts keystore is used, no keyPassword needs to be provided. -keyType Use this element to specify the type of the used keystore. The default type is jks. If the used keystore is of type jks, you do not have to provide this parameter.
Establish connection using dummy certs
To establish an SSL connection with a WebSphere Portal Express server using the dummy certificate stores provided by WAS...
xmlaccess.sh -user wpsadmin -password your_password -url https://portalhost:9444/wps/config/ -in $PortalHome/doc/xml-samples/ExportAllUsers.xml -out result.xml -trustStore $WAS_HOME/profiles/wp_profile/etc/DummyClientTrustFile.jks -trustPassword WebASTo run this example configure the SSL configuration in WAS using...
- DummyServerKeyFile.jks
- DummyServerTrustFile.jks
...for secure connections.
This method requires thats that client authentication must not be active.
Provide client authentication
If the option require client authentication is active, you need to provide a keyfile when establishing the SSL connection with the XML configuration interface:
xmlaccess.sh -user wpsadmin -password yourpassword -url https://portalhost:9444/wps/config/ -in $PortalHome/doc/xml-samples/ExportAllUsers.xml -out result.xml -trustStore $WAS_HOME/profiles/wp_profile/etc/DummyClientTrustFile.jks -trustPassword WebAS -keyStore $WAS_HOME/profiles/wp_profile/etc/DummyClientKeyFile.jks -keyPassword WebASThis example allows the XML configuration interface to send a client certificate to the server, if the server requests one. Using client certificate authentication is required wherever the number of clients that can administer WebSphere Portal Express needs to be controlled. Only clients with the correct client certificate will be able establish a connection with WebSphere Portal Express.
XML Syntax for exporting and importing credential vault data
When using the XML command line client for credential export, the command syntax is slightly different than normal command line client use because there are two additional parameters:
xmlaccess -user user_ID -password password -url https://myhost:9444/wps/config/ -truststore $WAS_HOME/profiles/wp_profile/etc/DummyClientTrustFile.jks -trustpwd WebAS -in input_file.xml -out result_file.xml -credentialexport -passphrase encryptionPassphraseThe following rules apply to the above parameters:
- The options credentialexport and passphrase are mandatory for export or import of encrypted credential secrets during migration.
- The options...
- credentialexport
- passphrase
...are optional for all XML Configuration actions that do not export or import encrypted credential secrets during migration.
Additional XML Syntax elements for credential secret migration
Syntax element Description -credentialexport This is a parameter without value that indicates that export of credentials should be enabled -passphrase Use this element to specify the encryptionPassPhrase for the encryption. The minimum length of this string is the number of bits set as export keylength in the VaultService.properties file divided by 8. The -passphrase value is used to create a key of the specified length for the encryption.
The following is an example of how to use the XML configuration interface to export/import credential secrets using HTTPS:
xmlaccess.sh -user wpsadmin -password your_password -url https://portalhost:9444/wps/config/ -in ExportedCredentialSecrets.xml -out result.xml -credentialexport -passphrase JGD786JHgasdf8a67kjhUIT7sdj7nsh776jasdf786regUFZT756675zufurz -truststore $WAS_HOME/profiles/wp_profile/etc/DummyClientTrustFile.jks -trustpwd WebASUse the same passphrase for both export and import
The import may fail if the user DN schema has been changed between the previous and the current system or when credentials for users are contained in the xml file that are not present in the current system. In this case, manually remove the obsolete credential entries from the XML file before executing the import
For security reasons use an HTTPS connection when importing credentials; however, if you choose not to, set the export.enforceSSL configuration property to false.
XML input and output
An XML file that you process must always be in UTF-8 encoding and must specify the following root element and schema:
<?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd" type="export|update"> ...configuration... </request>For an XML export, specify export for the request type.
For an XML import, specify update for the request type.
When the XML request has been processed on the server, the resulting XML output is sent back to the client and written to the standard output. You can write the output to an XML file by using the -out command line option. Using this option always writes the output in UTF-8 encoding. If you do not use this option, the output is written in a console encoding that depends on your operating system and active locale. It may therefore be invalid XML.
The command line syntax and XML processing is the same for both exports and imports. You specify an XML input file to the XML configuration interface, and the XML configuration interface returns a resulting XML file.
The difference between export and import is determined by whether you set the request type to export or update in the XML file that you specify in the command line request. When importing, the resources action attribute can have the following values...
- locate
- create
- update
The normal procedure for exporting a configuration or part of it and then importing it to another consists...
- Run the XML command line interface with a file that has a request type of export.
You can use one of the XML sample files.
The file returned by the XML command line interface has specified update for the request type and locate or update for the individual resources actions. This file is ready to be used for an XML import.
- Modify the XML result file as required.
- Run the XML command line interface, specifying the XML file that resulted from the XML export.
The XML command line interface returns a result file that indicates whether the specified resources were imported successfully, or what errors might have occurred.
Transfer a complete configuration
This example exports the complete portal configuration, not including users, from a stage portal (Server2) to a production portal (prodportal).
Moving users may be useful when transferring configurations between development installations that do not use LDAP for the user repository.
Before you begin
- WebSphere Portal Express is installed on stageportal.
- stageportal has the new configuration you want to transfer to prodportal.
- prodportal has an empty portal.
To transfer a complete portal configuration:
- Export stageportal configuration...
cd portal_server_root/binxmlaccess.sh -in ExportRelease.xml -user wpsadmin -password wpsadminpwd -url http://stageportal.example.com:port/wps/config -out stageportal_config.xml
- If you have installed other portlets or applications additional to the ones shipped with the portal, copy the necessary WAR files from stageportal to the following directory on prodportal...
portal_server_root/deployed/archive
On Windows the name of the WAR file must be 25 characters or less.
All the files listed in the XML result file must be present and accessible in the specified locations on prodportal. In general, all deployed WAR files are copied to...
portal_server_root/deployed/archive
It may be sufficient to copy the contents of that deployed/archive directory to the corresponding directory on your target server and leave the file stageportal_config.xml unchanged. However, to be sure, check the file for warnings related to wrong URLs.
If files are listed in the XML script...
For example, for the Personalization portlets that are predeployed as part of the portal installation, edit...
stageportal_config.xml
...search for the following URLs...
...and replace them with the following URLs...
cd portal_server_root/binxmlaccess.sh -in stageportal_config.xml -user wpsadmin -password wpsadminpwd -url http://prodportal.example.com:port/wps/config
Allow some time for this step to complete.
cd ../UserData
WPSconfig.sh -profileName wp_profile activate-portlets
<status element="all" result="ok">
Applications | Enterprise Applications
The production portal is now ready for use.
To move a complete configuration from a stage to a production server by using the portal ReleaseBuilder tool, use the sample file ExportRelease.xml.
The attribute domain="rel" indicates that only shared (as opposed to private) resources are exported. This sample file exports the complete portal configuration without private resources as required by the portal ReleaseBuilder tool.
To export partial configurations one specifies the XML hierarchy down to the specific portal resource to be exported. The element itself has an export action. Parents must be specified with a locate action.
Specify resources to export by using one of the following...
The ExportPage.xml sample uses the unique name wps.SamplePage to export a page. To create this page in a newly installed portal run DeployPortlet.xml.
You can use the Custom Unique Names administration portlet to look up object IDs and unique names of portal resources.
Executing ExportPage.xml results in an XML file similar to ExportPageResult.xml. You can use this file to update the page to the exported state, if it still exists in the portal. You could also use this file to re-create the page, in case you delete it later.
ExportPageResult.xml includes not only the page itself but also other configuration elements that are referred to by the page, for example the portlet that is placed on the page. These other elements have a locate action. The export does not include their full configuration data, but just enough information to look them up in the portal, assuming they already exist.
Exporting resource configurations normally creates update actions for all exported elements. This means that if the portal resource already exists on the importing system, the settings are modified, and if it does not yet exist, it is created. This in turn means that if you re-import the page into the portal that you exported it from, nothing changes.
You can import the XML file into another portal to create a copy of the page. This requires that the referenced resources (such as the portlet and the content parents) also exist on the target portal and can be found by an identifying attribute. In that case, the page and all contained resources take their object IDs with them, so that they have the same object IDs on the source and target system - the resources retain their identity.
You can avoid that by using the ID generating mode, where the object IDs in the input are not taken literally, but during the import process the resources obtain new object IDs when they are created on the target system. You apply ID generating mode by adding the following attribute to the main request tag:
<request . . . create-oids="true" . . . >
You can create a duplicate of the page in the portal from where you exported it by using the ID generating mode and changing the unique name of the page in the XML script. This way, the page and its changed name cannot be found for updating by either its object ID or its unique name, therefore a new page with the same settings is created. If you do this, you should change the page title as well, so that you can distinguish between the two pages. The CopyPage.xml sample shows how this script would look.
When exporting resources to XML scripts, it is possible and often useful to export several resources by using one request. The ExportPortletAndPage.xml example extends the ExportPage.xml example by including also the portlet that is contained on the page. The resulting XML file contains the complete configuration data of the portlet and the page.
The ExportSubTree.xml example shows how you export subtrees of the portal content hierarchy. It exports part of the predefined administration page hierarchy that was created during the portal installation.
The ExportAllPortlets.xml example shows the use of the asterisk character ( * ) as a wildcard to export all resources of a given type. This example exports all the Web modules that have been installed in the portal and their contained portlets.
In addition to copying and restoring configurations of existing resources, you can also use the XML configuration interface to install new resources in the portal or as an alternative to the user interface for performing some administration tasks. In these cases, you cannot simply export and re-import XML scripts, but you have to edit them. In most cases, it is still useful to start with an XML export and only partially modify it, rather than writing complete new XML scripts. The following scripts show examples for modifying different resources in the portal configuration by using XML scripts.
Note that all the examples use the ID generating mode and do not specify literal object IDs. Therefore they can be executed on any portal installation and do not depend on hard coded object ID values. As noted above, using literal object IDs only makes sense if you really want to create two instances of the same resource, and if you have a controlled environment where you can guarantee that all object IDs that your resources depend on have exactly the required values. As object IDs are difficult to use for identifying the resources, the examples assign unique names to most top-level resources. This way they can be referenced later, and the resources are not duplicated if you execute the scripts twice.
The first example file DeployPortlet.xml shows how you deploy a portlet and create a simple test page to display the portlet. Note that some of the attributes in the XML must match the corresponding settings that were defined in the portlet.xml deployment descriptor in the portlet WAR file. This is necessary so that the XML processing can properly identify the contents of the war file. When you want to deploy a different portlet, not only specify a different WAR file but also adapt those attributes. Also note that the configuration specified for the portlet is less than what you see in an XML export result for the portlet.
For example, the localized titles are not included in the XML script.
This is because those settings are specified in the portlet.xml deployment descriptor; there is no need to override them with the XML configuration interface.
As Windows limits the maximum path length to 260 characters, the name of the WAR file must be 25 characters or less. Deploying a WAR file with a name that is more than 25 characters will result in an error.
The CreatePage.xml sample shows the following additional possibilities:
Both examples use a simple page layout with just one row and one column.
To generate more complex page layouts, you can use the administration portlets to create them. You can export the result to generate a template for your XML scripts.
When you create new resources, you may want to define specific access control settings for them, for example to make them visible to all portal users. The UpdateAccesscontrol.xml example shows the syntax for specifying different access control settings. This sample updates existing resources, but you can of course use the same syntax to define access control settings for new resources while creating them in an XML script. This sample also shows how you can specify access control user roles on virtual resources. This allows you to give a user access to all resources of a specific type that exist in the portal.
The CreateURL.xml sample defines a URL mapping for the sample page that was created with the DeployPortlet.xml example above.
After creating the URL mapping you can access the page directly by entering that URL in the browser.
The DeployTheme.xml example shows how you can use XML scripts to install new themes and skins into the portal. Be aware that the XML scripts create these resources only in the portal database, so that they can be used in the portal. In addition, you have to write the JSPs that perform the actual visualization and copy them to the resource directory specified in the XML before you can use the theme in the portal.
The ModifyPortlet.xml example changes settings of a portlet instance that is shown on a page. Such settings are normally set in the edit mode of the portlet. It depends on the code of the portlet which settings are stored and how they are used.
The CreateUser.xml example imports a new user into the portal. It also creates a group containing only that one user.
To add a new language to the portal, use the CreateLanguage.xml example.
To prepare for running this XML script, you have to insert resource bundles and, where applicable, JSPs for the new language. For details about how to do this refer to Supporting a new language.
The UpdateVault.xml example demonstrates how to create new resources in the portal credential vault with an XML script.
The ClonePortlet.xml example shows how you can use the XML configuration interface to add new portlets with different settings to existing applications.
The Transaction.xml example demonstrates the effect of using different transaction levels for the execution of an XML import.
The MovePage.xml example shows you how to move a page to another node. -
The actual move of the page is done by the last two lines in the sample file. They are highlighted in the representation of the sample file here.
You can change the states of portlets, portlet applications, and Web applications between active and inactive by using the portal XML configuration interface. The ActivatePortlet.xml example shows you how to do this.
The Task.xml example shows you how to schedule the cleanup of pages that have been marked for deletion. For details about the portal resource cleanup service, refer to Delayed cleanup of deleted portal pages.
For more details about how to configure the schedule for the delayed deletion cleanup or run an individual cleanup, refer to the XML configuration interface: reference under the task tag.
Notes:
You can manually predeploy portlet application WAR files using the WAS Administration console. You can later register and configure the predeployed portlet applications into WebSphere Portal Express, together with other J2EE resources and artifacts, by using the XML configuration interface.
Use the sample file RegisterPreDeployedEAR.xml to install a predeployed portlet. You might have to change this sample for your requirements.
For more information about how to predeploy portlets refer to Deploying J2EE resources with portlet application WAR files.
If portal users or groups have been removed from the user registry, but not from the portal database, or if users have been muted, for example after too many wrong password attempts, you can identify and list these users and groups by using the cleanup-users attribute. Specify the cleanup-users attribute with the request tag of type export, and set its value to true .
You also need to set the export-users attribute to true.
The CleanupUsers.xml sample file shows an example of how you can export such users and groups. The resulting output file lists the affected users and groups with their action set to delete. You need to check the list and remove all users and groups that you want to keep in the portal database. For example, you might want to keep the muted users and re-enable their passwords. After you have done this, import the file into the portal. All users and groups that remain in the list are removed from the portal database.
After deleting these entries via the modified XML script, all customization is lost for the deleted users and groups.
See Deregistering users and groups from WebSphere Portal Express more more info.
To prepare for deleting orphaned data, use the ExportIncludingOrphanedData.xml example to perform an export that includes all orphaned data. For details about orphaned data and how to delete them refer to Deleting orphaned data.