XMLAccess简介
/xmlaccess.sh 参数:
EJPXB0001I: 命令行参数: -in <xml input file> [-user <username>] Will be queried over the console, if omitted [-password <password>] Will be queried over the console, if omitted [-out <output file>] default: write to stdout [-url <portal config url>] default: http://localhost/wps/config [-attempts <max connection attempts>] default: 1 attempt, no retries [-truststore <filename of the trust store for HTTPS>] default: $JAVA_HOME/lib/security/cacerts [-trustpwd <password for the trust store for HTTPS>] default: <empty> [-trusttype <filetype of the trust store for HTTPS>] default: jks [-keystore <filename of the key store for HTTPS>] default: $JAVA_HOME/lib/security/cacerts [-keypwd <password for the key store for HTTPS>] default: <empty> [-keytype <filetype of the key store for HTTPS>] default: jks [-credentialexport] enables export and import of credential secrets [-encryptionPassphrase <passphrase>] passphrase for credential encryption and decryption [-echo] simply return input instead of processing it
迁移门户网站的Portlet,(包括Portlet的权限)
从门户网站中导出内容的命令:
操作系统 |
命令 |
Windows |
xmlaccess.bat -in ExportRelease.xml -user wpsadmin -password wpsadminpwd -url http://hostname:port/wps/ config/virtualportalContext -out virtualportal_output.xml |
UNIX |
./xmlaccess.sh -in ExportRelease.xml -user wpsadmin -password wpsadminpwd -url http://hostname:port/wps/ config/virtualportalContext -out virtualportal_output.xml |
IBM i |
xmlaccess.sh -in ExportRelease.xml -user wpsadmin -password wpsadminpwd -url http://hostname:port/wps/ config/virtualportalContext -out virtualportal_output.xml |
导入到门户网站的命令
操作系统 |
命令 |
Windows |
xmlaccess.bat -in virtualportal_output.xml -user wpsadmin -password wpsadminpwd -url http:// hostname:port/wps/config/virtualportalContext -out Output.xml |
UNIX |
./xmlaccess.sh -in virtualportal_output.xml -user wpsadmin -password wpsadminpwd -url http:// hostname:port/wps/config/virtualportalContext -out Output.xml |
IBM i |
xmlaccess.sh -in virtualportal_output.xml -user wpsadmin -password wpsadminpwd -url http:// hostname:port/wps/config/virtualportalContext -out Output.xml |
xml-samples:
在一下目录中可以找到xml的样例文件
/usr/IBM/WebSphere/PortalServer/doc/xml-samples
导出门户网站的Portlet
案例:
XX联通:
/usr/IBM/WebSphere/PortalServer/bin/xmlaccess.sh -in ExportAllPortlets.xml -user wpsbind -password 1qazcde3 -url http://10.68.20.83:10038/wps/config -out Out_ExportNMunicom.xml
/usr/IBM/WebSphere/AppServer/profiles/wp_profile/installedApps/wps01/wps.ear/wps.war/themes/html/NMUnicomNew
看下导出的portel xml文件:
上面截图是导出所有,也就是Object,使用的模板是 ExportAllPortlets.xml
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd" type="export"> <!-- Example for using the * wildcard to export all resources of a given type. This script exports all Web modules (and their contained portlets) that are defined in the portal. --> <portal action="locate"> <web-app objectid="*" action="export"/> </portal> </request>
从上面的notepadd++编辑器里看到 我们要导出的portel的uid为
uid="com.ibm.chinaunicomportletv2.ChinaUnicomPortletV2Portlet.f7afb8e112.webmod
所有我们将xml模板修改为:
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd" type="export"> <!-- Example for using the * wildcard to export all resources of a given type. This script exports all Web modules (and their contained portlets) that are defined in the portal. --> <portal action="locate"> <web-app action="export" uid="com.ibm.chinaunicomportletv2.ChinaUnicomPortletV2Portlet.f7afb8e112.webmod"/> </portal> </request>
Out_ExportNMunicom.xml 内容:
<?xml version="1.0" encoding="UTF-8"?> <!-- IBM WebSphere Portal/6.0.1.1 build wp6011_073 exported on Fri Mar 14 15:24:10 GMT+08:00 2014 from wps02/10.68.20.82 --> <!-- 1 [web-app 1_HBNK7F5408VNA0IO3KP8UO00K5] --> <!-- 2 [servlet V_HBNK7F5408VNA0IO3KP8UO0024] --> ...... <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" build="wp6011_073" type="update" version="6.0.1.1" xsi:noNamespaceSchemaLocation="PortalConfig_6.0.1.xsd"> <portal action="locate"> <web-app action="update" active="true" domain="rel" objectid="1_HBNK7F5408VNA0IO3KP8UO00K5" removable="true" uid="com.ibm.chinaunicomportletv2.ChinaUnicomPortletV2Portlet.f7afb8e112.webmod"> <url>file://localhost/$user_install_root$/PortalServer/deployed/archive/com.ibm.chinaunicomportletv2.ChinaUnicomPortletV2Portlet.f7afb8e112.webmod/ChinaUnicomPortletV2.war</url> <access-control externalized="false" owner="uid=wpsbind,cn=apps,dc=nm,dc=unicom" private="false"/> ...... <localedata locale="ar"> <title>com.ibm.chinaunicomportletv2.ChinaUnicomPortletV2Portlet.f7afb8e112</title> </localedata> .....
注意:<url>标签里相对路径的地址。
导入门户网站的Portlet
导入:
[root@wpstest bin]# ./xmlaccess.sh -in /data/IBM/Out_ExportNMunicom.xml -user wpadmin -password password -url http://172.16.89.7:10040/wps/config -out output_all.xml
这样portel就全部导入了。
访问portal管理控制台查看如下
# /usr/IBM/WebSphere/PortalServer/bin/xmlaccess.sh -in ExportPage.xml -user wpsbind -password 1qazcde3 -url http://10.68.20.xx:10038/wps/config -out Out_ExportNMunicom_page.xml
上图是导出的全部页面:
主页下面的所有。
模板:
ExportSubTree.xml
df
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd" type="export"> <!-- Sample for exporting subtree of the content hierarchy. This script exports the page customizer place with all contained pages. --> <portal action="locate"> <content-node action="export" uniquename="ibm.portal.Home" export-descendants="true"/> </portal> </request>