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 (”. See below for other tips on the script.

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

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.