Use the SCA default binding to find and locate SCA services
The product supports APIs that Service Component Architecture (SCA) and non-SCA clients can use to find and invoke SCA services over the SCA default binding.
A non-SCA client can use the OASIS SCAClientFactory API to obtain a service proxy for an OASIS SCA service in the same domain (product cell). An OASIS SCA client also can use this API as an alternative to wiring a reference in the composite file.
A non-SCA client can use the product CompositeContext API to obtain a service proxy for an OSOA SCA service in the same domain. An OSOA SCA client also can use this API as an alternative to wiring a reference in the composite file.
The SCA service must be deployed, running, and accessible over the default binding, <binding.sca>.
- Obtain a service proxy for an OASIS SCA service in the same domain.
The following example shows how to use the OASIS SCAClientFactory API:
import org.oasisopen.sca.client.SCAClientFactory SCAClientFactory scaClientFactory = SCAClientFactory.newInstance(URI.create("default")); EchoService echoService = scaClientFactory.getService(EchoService.class, "SCASimpleEchoService");
- Obtain a service proxy for an OSOA SCA service in the same domain.
The following example shows how to use the product CompositeContext API:
import com.ibm.websphere.sca.context.CurrentCompositeContext; import com.ibm.websphere.sca.context.CompositeContext; CompositeContext compositeContext = CurrentCompositeContext.getContext(); EchoService echoService = (EchoService) compositeContext.getService(EchoService.class, "SCASimpleEchoService");
What to do next
To improve performance, the caller can cache the service proxy returned by SCAClientFactory.getService() or CompositeContext.getContext(). Caching echoService in the example can avoid calls to the service registry for subsequent requests, resulting in better performance.
Related tasks
Develop SCA services from existing WSDL files Develop SCA services with existing Java code Develop SCA service clients Specify bindings in an SCA environment
Service Component Architecture specifications and APIs