Oracle Service Bus: Obtaining a list of exposed SOAP HTTP endpoints

Maarten Smeets 5

The Oracle Service Bus is often used for service virtualization. Endpoints are exposed on the Service Bus which proxy other services. Using such an abstraction layer can provide benefits such as (among many other things) monitoring/logging, dealing with different versions of services, throttling/error handling and result caching. In this blog I will provide a small (Java) script, which works for SOA Suite 11g and 12c, which determines exposed endpoints on the Service Bus.Exposed SOAP HTTP endpoints

How to determine endpoints?

In order to determine endpoints on the Service Bus, The Service Bus MBeans can be accessed. These MBeans can obtained from within a local context inside the Service Bus or remotely via JMX (when configured, see In this example I’ll use a remote connection to a Weblogic Server instance which runs on the same machine (JDeveloper IntegratedWeblogicServer). To browse MBeans, you can use jvisualvm ( which is distributed as part of the Oracle JDK. JVisualVM has a plugin to browse MBeans.

Screenshot from 2014-10-20 10:04:14

Screenshot from 2014-10-20 10:06:01

When connected, the Service Bus MBeans are located under The proxy services which define the exposed endpoints, can be recognized by the Proxy$ prefix. In order to determine the actual endpoint, you can look at the ResourceConfigurationMBean of the proxy service. Under configuration, transport-configuration you can find a property called url. The script also filters HTTP SOAP services since the url field is also used for other transports. A replace of // with / is done on the combination server:host/url since the url can start with a /. This causes no difference in functioning but provides better readable output. If you want WSDL’s, you can add ‘?wsdl’ to the obtained endpoint.

The script requires some libraries. For 11g, you can look at On that blog, more specific API calls are done which have more dependencies. This example requires less. For 12c, it was enough to add the Weblogic 12.1 remote client library in the project properties.

Screenshot from 2014-10-20 11:30:33

The script does not determine the hostname/port of the server the Service Bus is currently running on. This could lead to misinterpretation when for example a load-balancer or another proxy component (such as OHS) is used.

The script




import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Set;


import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;


public class SBEndpointList {

private static MBeanServerConnection connection;
private static String HOST = "localhost";
private static Integer PORT = 7101;
private static String USERNAME = "weblogic";
private static String PASSWORD = "Welcome01";

public SBEndpointList() throws IOException, MalformedURLException, NamingException {
this.connection = this.getMBeanServerConnection();

private ObjectName[] getObjectNames(ObjectName base, String child) throws Exception {
return (ObjectName[]) connection.getAttribute(base, child);

public ArrayList<String> getEndpoints() throws Exception {
ArrayList<String> result = new ArrayList<String>();

Set<ObjectName> osbconfigs =
connection.queryNames(new ObjectName(",*"), null);

for (ObjectName config : osbconfigs) {
if (config.getKeyProperty("Name").startsWith("ProxyService$")) {
CompositeDataSupport cds = (CompositeDataSupport) connection.getAttribute(config, "Configuration");
String servicetype = (String) cds.get("service-type");
if (servicetype.equals("SOAP")) {
CompositeDataSupport pstt = (CompositeDataSupport) cds.get("transport-configuration");
String url = (String) pstt.get("url");
String tt = (String) pstt.get("transport-type");
if (tt.equals("http")) {
result.add("http://SERVER:PORT" +("/" + url).replace("//" ,"/") );
return result;
private JMXConnector initRemoteConnection(String hostname, int port, String username,
String password) throws IOException, MalformedURLException {
JMXServiceURL serviceURL =
new JMXServiceURL("t3", hostname, port, "/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME);
Hashtable<String, String> h = new Hashtable<String, String>();
h.put(Context.SECURITY_PRINCIPAL, username);
h.put(Context.SECURITY_CREDENTIALS, password);
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "");
return JMXConnectorFactory.connect(serviceURL, h);

private MBeanServerConnection getMBeanServerConnection() throws IOException, MalformedURLException,
NamingException {
try {
InitialContext ctx = new InitialContext();
MBeanServer server = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");
return server;
} catch (Exception e) {
JMXConnector jmxcon = initRemoteConnection(HOST, PORT, USERNAME, PASSWORD);
return jmxcon.getMBeanServerConnection();

public static void main(String[] args) throws IOException, MalformedURLException, Exception {
SBEndpointList me = new SBEndpointList();

ArrayList<String> result = me.getEndpoints();
for (String endpoint : result) {




5 thoughts on “Oracle Service Bus: Obtaining a list of exposed SOAP HTTP endpoints

  1. Very good! Exactly what I was looking for to extract data from OSB!
    Thank you very much!

  2. This technique does not appear to work on or later. There’s no Configuration/transport-configuration structure in the OSB MBean.

  3. Thanks for the article, it’s really nice. I cannot find the way how to retrieve the additional information such as HTTP Transport Configuration details (Read Timeout, Connection Timeout etc..), can you please help?

    1. Were you able to retrieve HTTP Transport Configuration details (Read Timeout, Connection Timeout etc..)?

  4. Hi Maarten,

    I have created a Generic Rest Service in Service Bus 12c which will get hostname,Params and template values from dvm, the Service is working as expected.

    Now i want to dynamically pass security information (service account) depending on the which endpoint i am invoking.But i am not able to find service-account element in outbound header properties. Could you please let me know any other way to dynamically pass username/password.


Comments are closed.

Next Post

Getting started with ApacheDS - LDAP Server and Directory Studio

Inspired by the work and some excellent blog articles by my colleague Maarten Smeets – and while writing about the LDAP Adapter in SOA Suite 12c for the Oracle SOA Suite 12c Handbook) I decided to give ApacheDS (LDAP Directory) a spin. This article lists the very basic steps for […]
%d bloggers like this: