List Oracle Service Bus EndPoints in WLST

If you administer or need to support an Oracle Service Bus installation, you may need to do a fast check on all the systems that are “connected” to the service bus.

In this post I show a simple WLST script that allows to extract all the EndPoints.

A very little theoretical introduction

In Oracle Service Bus (Formerly also known as “BEA AquaLogic Service Bus”) every remotely connected service is configured as “Business Service”. The Business Service configuration usually contains the information on where is the service in the “EndPoint URI” configuration field.

A good tutorial giving infos on Business Services, endpoints, and other basic concept of Oracle Service Bus is here: How to Provision a Service in Oracle Service Bus.

The script

The script was tested on “AquaLogic Service Bus 2.6” and on “Oracle Service Bus 11g (11.1.1.4)”. See below for other tips on the script.

from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import BusinessServiceConfigurationMBean
 
from com.bea.wli.sb.util import EnvValueTypes
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from xml.dom.minidom import parseString
 
connect(userConfigFile='<userConfigFile_location>', userKeyFile='<userKeyFile_location>', url='t3://<myserver_ip>:<myserver_port>')
domName=cmo.getName()
domainRuntime()
sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)
sessionName="WLSTSession"+ str(System.currentTimeMillis())
sessionMBean.createSession(sessionName)
alsbSession = findService(ALSBConfigurationMBean.NAME + "." + sessionName, ALSBConfigurationMBean.TYPE)
alsbCore = findService(ALSBConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)
allRefs=alsbCore.getRefs(Ref.DOMAIN)
for ref in allRefs.iterator():
    typeId = ref.getTypeId()
    if typeId == "BusinessService" :
        name=ref.getFullName()
        uris=alsbSession.getEnvValue(ref, EnvValueTypes.SERVICE_URI_TABLE, None)
        print name
        print uris
        print

The connection is performed by using user security files that must be created with the storeUserConfig WLST command. Change <userConfigFile_location>, <userKeyFile_location>, <myserver_ip>, <myserver_port> with the current values.