Question & Answer
Question
How to export policies using the XML Configuration Interface or XMLAccess
Answer
The XML DTD has changed in WebSphere Portal Version 7. The changes may render XML used to export policies in previous versions of WebSphere Portal obsolete.
In the past, it was possible to export a single, named theme policy by specifying the theme policy name and to simultaneously export the theme policy to a named XML file using this XML:
<policy-node action="export" label="MyTheme" type="theme">
<url>file:///home/portal/MyThemePolicy/ThemePolicy_MyTheme.xml</url>
</policy-node>
According to Removed XML resources in WebSphere Portal Version 7.0 "policy-node items no longer support url definitions."
This means that the XML tag <url> cannot be used. In addition, it is no longer possible to use the "type" keyword which means the following XML will no longer export all theme policies.
<policy-node action="update" type="theme" path="*">
The examples below are complete XML files that can be used to export policies.
1. To export a single theme policy if the policy name is known
In this example, "SingleTopNavLevel2" is the name of the theme policy to be exported.
<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="export">
<portal action="locate">
<policy-node action="export" path="/theme/SingleTopNavLevel2"/>
</portal>
</request>
2. To export all theme policies
<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="export">
<portal action="locate">
<policy-node action="export" path="/theme"
export-descendants="true"/>
</portal>
</request>
3. To export all policies, including theme policies, Composite Application and Mail
<?xml version="1.0" encoding="UTF-8"?>
<request xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd"
create-oids="true" type="export"
xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance">
<portal action="locate">
<policy-node action="export" path="*"/>
</portal>
</request>
Policy exports generated on WebSphere Portal 7 using XML input files from earlier versions, for example, those that contain the <url> tag, may result in the following exception on import:
StorageApi E com.ibm.wps.policy.commands.StorageApi getPvs EJQAB0013E: A general policy exception occurred.
com.ibm.portal.WpsException: EJQAB0013E: A general policy exception occurred.
at com.ibm.wps.policy.commands.StorageApi.getPvs
at com.ibm.wps.command.xml.items.PolicyNodeItem.locate
...
Caused by: java.lang.ClassCastException: com.ibm.wps.policy.pvs.impl.PolicyRootImpl incompatible with com.ibm.wps.policy.pvs.PvsNode2
at com.ibm.wps.policy.commands.StorageApi.getPvs
Perform the export again using one of the sample input files shown above.
The attached sample file exports all Policies using the XML in example #3 above.
ExportAllPolicies.xml
Export using a command line similar to:
xmlaccess -user <PortalAdmin>-password <Mypassword> -url hxxp://Portalhost.ibm.com:10039/wps/config -in ExportAllPolicies.xml -out AllPoliciesresult.xml
Was this topic helpful?
Document Information
Modified date:
03 December 2021
UID
swg21576744