Read Time:2 Minute, 51 Second
I was looking for a way how to enable or disable a proxy service within Oracle Service Bus 11g with WLST (WebLogic Scripting tool)
Here’s the way I found out to do it.
I created a python script to be called with wlst, osb_enable_service.py
First set your environment settings right:
source $WL_DOMAIN_DIR/bin/setDomainEnv.sh ($WL_DOMAIN_DIR and $WL_DOMAIN should be set in your OS profile, like .bash_profile or .profile)
Call the script with wlst: $WL_HOME/common/bin/wlst.sh  osb_enable_service.py
Fill in the requirements…
Project Name: CustomProvider
Proxy Service :ReportAlertProxy
type in : enable or disable –>disable
Connecting to t3://amssrv……:7001 with userid weblogic …
Successfully connected to Admin Server ‘AdminServer’ that belongs to domain ‘osb_trn_domain’.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
(‘… after session. Session is: ‘, SessionScript1294672366163)
(‘SessionMBean is: ‘, [MBeanServerInvocationHandler]com.bea:Name=SessionManagement,Type=com.bea.wli.sb.management.configuration.SessionManagementMBean)
Session was created … SessionScript1294672366163
Disabling ReportAlertProxy
has been  completed
Disconnected from weblogic server: AdminServer
Exiting WebLogic Scripting Tool.
To be sure, check in the OSB Console if the script did it’s work:
Now, do the same to enable:
Project Name: CustomProvider
Proxy Service :ReportAlertProxy
type in : enable disable –>enable
And check again in the OSB Console:

Here’s the script:
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
admin_server=”<WebLogic Server host>“
admin_server_poort=”7001″
wluser=”weblogic”
wlpassword=”<wl_password>“
domein=<your_domain name>“
project=raw_input(“Project Name: ” )
service=raw_input(“Proxy Service :”)
action=raw_input(“type in : enable disable –>”)
connect(wluser, wlpassword, ‘t3://’+ admin_server + ‘:’ + admin_server_poort)
domainRuntime()
# Create a session name
#sessionName =
sessionName = String(“SessionScript”+Long(System.currentTimeMillis()).toString())
print(‘… after session. Session is: ‘, sessionName)
# Get the session MBean and create a session
sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)
print(‘SessionMBean is: ‘, sessionMBean)
sessionMBean.createSession(sessionName)
print(String(‘Session was created … ‘).concat(sessionName))
# Get the ProxyServiceConfigurationMBean specific to our session
mbean = findService(String(“ProxyServiceConfiguration.”).concat(sessionName),’com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean’)
# Creates a reference to a folder.
# and ‘ProxyServices’ is a folder in the project
#folderRef = Refs.makeParentRef(‘project/’)
# and ‘ProxyServices’ is a folder in the project
projectName = Refs.makeParentRef(project + ‘/’)
proxyRef = Refs.makeProxyRef(projectName, service)
# do the action
def setService():
if action == ‘disable’:
print “Disabling ” Â + service
mbean.disableService(proxyRef)
else:
print “Enabling ” + service
mbean.enableService(proxyRef)
# or enable it
setService()
# Now commit (activate) the changes
sessionMBean.activateSession(sessionName, “disabled PS”)
print (‘ has been  completed’)
print
disconnect()
exit()
Started in pharmacy, I made the change to IT in 1996. I am an Oracle Fusion Middleware Architect at AMIS, with focus on technical infrastructure, Serverside solutions, installing, administering, configuring the Oracle Fusion Middleware stack. My experience is from integrations at telco´s using Oracle AIA, Oracle Portal, OID, Forms&Reports, Discoverer upto the latest Oracle WebLogic 11g releases with practically all Oracle products running on top of it
Happy
0 0 %
Sad
0 0 %
Excited
0 0 %
Sleepy
0 0 %
Angry
0 0 %
Surprise
0 0 %
Like this:
Like Loading...