Oracle SOA Composite Locator Client

This post throws light on the SOA Facade APIs available as part of Oracle’s SOA Suite Infra Management Java API. It exposes operations for attributes viz. composites, components, services and references. All these can be programmatically managed via a powerful store of Java API which serves as an effective alternative to managing the same attributes with Oracle’s Enterprise Manager (EM).
The Locator interface exposes methods that serve as important entry point into the facade API. LocatorFactory can be used to fetch direct connection to the Locator. Steps involved are:

jndiProps = new Hashtable<String, String>(); jndiProps.put(Context.PROVIDER_URL, "jndi_server_provider"); jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "context_class_name"); jndiProps.put(Context.SECURITY_PRINCIPAL, "user_name"); jndiProps.put(Context.SECURITY_CREDENTIALS, "password");
  • Use LocatorFacotry to get instance of Locator
Locator locator = LocatorFactory.createLocator(jndiProps);
  • Locator API can be used to retrieve various SCA artifacts viz. composites, components, references, etc. The example shown here demonstrates ‘direct binding’ which enables clients to directly invoke composite services thus bypassing the overhead of XML conversion required for web service bindings. Some of the most commonly used Locator API methods are mentioned below:

We first create an instance of CompositeLocatorAuthenticationClient. We will employ singleton design to avoid multiple instances creation.

public class CompositeLocatorAuthenticationClient {
private Locator locator = null;
private Hashtable jndiProps = null;
private static CompositeLocatorAuthenticationClient soaAuthenticationClient;
private CompositeLocatorAuthenticationClient() {
jndiProps = new Hashtable();
jndiProps.put(Context.PROVIDER_URL, ""));
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "");
jndiProps.put(Context.SECURITY_PRINCIPAL, "");
jndiProps.put(Context.SECURITY_CREDENTIALS, "");
jndiProps.put("dedicated.connection", "true");

public static CompositeLocatorAuthenticationClient
getAuthenticationClient() {
if (soaAuthenticationClient == null) {
soaAuthenticationClient = new
return soaAuthenticationClient;

public Locator getLocator(Hashtable aJndiProps) throws
CompositeLocatorAuthenticationException {
if (locator == null) {
try {
locator = LocatorFactory.createLocator(aJndiProps != null ?
aJndiProps : jndiProps);
} catch (Exception exception) {
throw new CompositeLocatorAuthenticationException("Error in
creating new instance for Locator", exception);
return locator;

public Locator getLocator() throws
CompositeLocatorAuthenticationException {
return getLocator(null);

We will now create a client class that would use the above CompositeLocatorClient to communicate with the underlying SOA infrastructure. The client below demonstrates how the audit-trail for a composite instance can be fetched using SOA APIs

public class CompositeLocatorClient {

private CompositeLocatorAuthenticationClient
authenticationClient = null;

public CompositeLocatorClient() {
authenticationClient = CompositeLocatorAuthenticationClient.

public Object getAuditTrail(String compositeName, String instanceTitle)
throws CompositeLocatorClientException {
CompositeInstanceFilter compositeInstanceFilter =
new CompositeInstanceFilter();
return getAuditTrail(compositeInstanceFilter);

private Object getAuditTrail(CompositeInstanceFilter compositeInstanceFilter)
throws CompositeLocatorClientException {
try {
Locator locator = this.authenticationClient.getLocator();
List compositeInstances = locator.
if (compositeInstances != null && compositeInstances.size() > 0) {
String ecid = compositeInstances.get(0).getECID();
return locator.getAuditTrail(ecid);
return null;
} catch (Exception exception) {
throw new CompositeLocatorClientException(exception);