Below is the script for enabling and disabling the proxy in OSB which may be required during any end system downtime or for just bouncing the proxy due to some issue like not picking up the messages from queue or any other one.
------------------------------------------------------------------------------------------------------------------
import wlstModule
import sys
import os
import socket
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.config import Ref
from java.lang import String
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
from java.lang import String
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
project = sys.argv[1]
print('project name is: ', project)
service = sys.argv[2]
print('service name is: ', service)
action = sys.argv[3]
print('operation name is: ', action)
connect('user','password','t3://AdminHost:Adminport')
domainRuntime()
print('WLST Connected')
sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
print('... after session. Session is: ', sessionName)
sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)
print('SessionMBean is: ', sessionMBean)
sessionMBean.createSession(sessionName)
print(String('Session was created ... ').concat(sessionName))
mbean = findService(String('ProxyServiceConfiguration.').concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean')
projectName = Refs.makeParentRef(project + '/')
proxyRef = Refs.makeProxyRef(projectName, service)
if action == 'disable' :
print "Disabling " + service +" has been completed"
mbean.disableService(proxyRef)
else :
print "Enabling " + service +" has been completed"
mbean.enableService(proxyRef)
if action == 'disable' :
service1 = service+" disabled"
print service1
sessionMBean.activateSession(sessionName, service1)
else :
service1 = service+" enabled"
print service1
sessionMBean.activateSession(sessionName, service1)
print
disconnect()
exit()
-------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
#!/bin/sh
export LOGFILE="/Mylocation/ProxyOperation/ProxyOperation.log"
if [ -f $LOGFILE ]; then
rm -f $LOGFILE
fi
rm -rf /Mylocation/ProxyOperation/ProxyOperation.log
WL_HOME="wl_home"
export WL_HOME
OSB_HOME="osb_home"
export CLASSPATH=$CLASSPATH:$OSB_HOME/Oracle_OSB/lib/sb-kernel-api.jar
export CLASSPATH=$CLASSPATH:$OSB_HOME/modules/com.bea.common.configfwk_1.2.1.0.jar
export CLASSPATH=$CLASSPATH:$OSB_HOME/Oracle_OSB/lib/alsb.jar
export CLASSPATH=$CLASSPATH:$OSB_HOME/Oracle_OSB/lib/sb-kernel-impl.jar
echo "Please enter operation you want to perform"
read PARAMETER1
cd /Mylocation/ProxyOperation/
sh ${WL_HOME}/common/bin/wlst.sh /Mylocation/ProxyOperation/ProxyOperation.py $1 $2 $PARAMETER1 >> /Mylocation/ProxyOperation/ProxyOperation.log
---------------------------------------------------------------------------------------------------------------------
Suppose path of your proxy service is as below (you can find this path from sbconsole)