Monday, August 19, 2013

Customizing the OSB Service through WLST script

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


2 comments:

  1. I dont see sb-kernel-api.jar and com.bea.common.configfwk_1.5.0.0.jar in OEPE 11.1.1.8.0. Please advise what to do in these situation

    ReplyDelete
  2. Hi Albin,
    In OSB 12c, I see the WLS policies are deprecated, we are now upgrading from 11g to 12c for OSB. As of 11g (11.1.1.7), WebLogic Security policies were deprecated, and are not supported in 12c (12.1.3). Because WebLogic security policies were available in 11g, deployment of the OWSM Policy Manager and use of the OWSM policies was optional. Since only OWSM policies are supported in 12c, OWSM Policy Manager deployment is mandatory. In my current domain which is on 11g, proxy services are using the WebLogic security policies on wsdl based proxy services, now have to deselect the WebLogic security policies from the proxy service and have to use OWSM policy, Please suggest how it can be done using WLST scripting/customization changes or any other approach in 12c, have to apply the changes on many web service based proxy services.

    Thanks in advance for our remarks.

    ReplyDelete