6 Configuring the Spring Application Context

An SCA service is a piece of program code providing a business function that is offered for use by other components. Services can be invoked as SCA references by the other components. For strict definitions of SCA services and references, see OASIS SCA Service Component Architecture Assembly Model Specification at http://www.osoa.org/download/attachments/35/SCA_AssemblyModel_V100.pdf?version=1.

SCA services and references are configured in the Spring application context, as described in the following sections:

Specifying References and Services

WebLogic Spring SCA supports the following two elements to specify SCA references and bindings:

sca:reference Element

The <sca:reference> element declares a Spring bean representing an SCA service external to the Spring application context. This element takes the following attributes:


Required. The name of the reference.


Required. The fully-qualified Java type of the interface or class representing the remote service. For example. if the external reference is to a Web Service, this would be the type of the client-side proxy to the Web Service.

For SCA references using a Web Service binding, the type used must be a JAX-WS compatible interface. The type used must be a JAX-WS compatible interface, generated from the external WSDL, using a JAX-WS compatible client generation tool such as the JAX-WS wsimport tool, the WebLogic clientgen Ant task, Oracle JDeveloper, or Oracle Enterprise Pack for Eclipse (OEPE).


Optional. The target bean for the reference if none is specified. This will improve performance by wiring to a local service, ignoring associated bindings.

sca:service Element

The <sca:service> element declares a Spring bean that WebLogic SCA exposes as a service. This element takes the following attributes:


Required. The name of the service.

If a name is not specified in the name attribute of a binding.ws subelement (see binding.ws Element Attributes), the name specified in the name attribute of the sca:service is published as the service name in the WSDL. However, if a binding.ws specifies a name, that name is published in the WSDL as the service name for that binding.


Required. The fully-qualified Java type of the Java class to be exposed as an SCA service.


Required. The bean to be exposed as a service.

See Appendix A, "WebLogic Spring SCA Schema (weblogic-sca.xsd)" for the WebLogic Spring SCA schema.

Binding Subelements

sca:reference elements and sca:service elements contain binding subelements to specify the binding(s) for the reference or service. An sca:reference element can have only one binding subelement. If more are specified, only the first one is used. An sca:service element can have none, one, or more binding subelements.

WebLogic Spring SCA supports the following binding elements:

  • <binding.ws> specifies that the binding is a Web Service binding.

  • <binding.ejb> specifies that the binding is an EJB session bean binding.

  • <binding.sca is the default. If binding.sca is specified or if no binding is specified, WebLogic SCA Runtime defaults to binding.ws.

For more information on the binding elements and the WebLogic SCA Runtime binding component implementations, see Chapter 7, "Configuring EJB Session Bean Bindings," and Chapter 8, "Configuring Web Service Bindings." For the binding element schemas, see Appendix A, "WebLogic SCA Schemas."

Sample Spring Application Context

A sample Spring application context is shown in Example 6-1. The context includes two Spring beans, beanX and beanY. The bean beanX is the entry point from WebLogic Spring SCA into the Spring application context and the bean beanY contains a reference to an external SCA service.

Example 6-1 Sample Spring Application Context

<beans xmlns="http://www.springframework.org/schema/beans"

  <!-- Expose the bean "X" as an SCA service named "SCAService"-->

  <sca:service name="SCAService" 
      <wlsb:binding.ws uri="/testService"/>
  <sca:reference name="SCAReference" type="org.xyz.someapp.SomeOtherInterface">
  <bean id="X" class="org.xyz.someapp.SomeClass">
    <property name="foo" ref="Y"/>
  <bean id="Y" class="org.xyz.someapp.SomeOtherClass">
    <property name="bar" ref="SCAReference"/>