Customizing the OSB Service through WLST script
This post will explain how to Customize the OSB Service through WLST script
The below WLST script will help us to run the OSB customization file.
import sys
from java.io import FileInputStream
from com.bea.wli.config.customization import Customization
from com.bea.wli.sb.management.importexport import ALSBImportOperation
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import SessionManagementMBean
def customizeOSBService(customizationFile):
SessionMBean = None
try:
connect('weblogic', 'welcome1', 't3://localhost:8000')
domainRuntime()
sessionName = String("Customization"+Long(System.currentTimeMillis()).toString())
SessionMBean = findService("SessionManagement", "com.bea.wli.sb.management.configuration.SessionManagementMBean")
SessionMBean.createSession(sessionName)
OSBConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
print 'Loading customization File', customizationFile
iStream = FileInputStream(customizationFile)
customizationList = Customization.fromXML(iStream)
OSBConfigurationMBean.customize(customizationList)
SessionMBean.activateSession(sessionName, "Complete customization using wlst")
disconnect()
except:
print "Unexpected error:", sys.exc_info()[0]
if SessionMBean != None:
SessionMBean.discardSession(sessionName)
raise
def main():
customizeOSBService('D:\Albin\ALSBCustomizationFile.xml')
print 'Successfully Completed customization'
main()
Customization File:
Customization file will help us to modify the environment specific values for a OSB project.
The previous post can be referred for more details on customization file.
Modify the environment specific values in the customization file.
Running the Script:
Login to the server and copy the wlst script and the Customization file to some location.
Execute the below two commands
CLASSPATH=$CLASSPATH:$OSBHOME/modules/com.bea.common.configfwk_1.5.0.0.jar:$OSBHOME/lib/sb-kernel-api.jar:$OSBHOME/lib/sb-kernel-impl.jar;export CLASSPATH
wlst.sh /home/eaiapp/Albin/OSBCustomization.wlst
Before executing the first command change the
com.bea.common.configfwk_1.5.0.0.jar file version according to your environment.
After successful execution verify the service from OSB Console
DOWNLOAD OSBCustomization.wlst