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
SCA services and references are configured in the Spring application context, as described in the following sections:
WebLogic Spring SCA supports the following two elements to specify SCA references and bindings:
<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 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.
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
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."
A sample Spring application context is shown in Example 6-1. The context includes two Spring beans,
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.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca" xmlns:wlsb="http://xmlns.oracle.com/weblogic/weblogic-sca-binding" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://xmlns.oracle.com/weblogic/weblogic-sca http://xmlns.oracle.com/weblogic/weblogic-sca/1.0/weblogic-sca.xsd http://xmlns.oracle.com/weblogic/weblogic-sca-binding http://xmlns.oracle.com/weblogic/weblogic-sca-binding/1.0/weblogic-sca-binding.xsd"> <!-- Expose the bean "X" as an SCA service named "SCAService"--> <sca:service name="SCAService" type="org.xyz.someapp.SomeInterface" target="X"> <wlsb:binding.ws uri="/testService"/> </sca:service> <sca:reference name="SCAReference" type="org.xyz.someapp.SomeOtherInterface"> <wlsb:binding.ws location="http://localhost:7001/jscaliteapp/myrefsvcnameuri" port="http://test.oracle.com#wsdl.endpoint(SCAService2/myrefportname)"/> </sca:reference> <bean id="X" class="org.xyz.someapp.SomeClass"> <property name="foo" ref="Y"/> </bean> <bean id="Y" class="org.xyz.someapp.SomeOtherClass"> <property name="bar" ref="SCAReference"/> </bean> </beans>