WAS v8.5 > Develop applications > Develop SCA composites > Specify bindings in an SCA environmentConfigure the SCA default binding
We can configure the SCA default binding for services and references. Bindings determine how a component communicates with the world outside its domain. Services use bindings to describe the access mechanism that clients must use to call the service. References use bindings to describe the access mechanism used to call a service. The SCA binding is also referred to as the default binding. The default binding is the binding used when no other binding is specified for a configuration of a component reference or service. Use this binding when an SCA client invokes an SCA service in the same domain. It is not intended to be interoperable in any way with other implementations of SCA runtime environments.
- Configure an SCA service with the SCA default binding.
If the service is only exposed over the default binding, then we do not need to explicitly add the <binding.sca> element because this binding is default binding for SCA. If your SCA service has more than one binding and the SCA default binding must be one of them, specify the <binding.sca> element in the composite definition.
- Configure an SCA reference with the SCA default binding.
For the reference, you also do not need to specify the <binding.sca> element. For an reference with a default binding, the reference specifies a target attribute indicating the target service. To indicate the target at the reference, specify target=componentName/serviceName. If only one service exists for the service component, then you only need to specify the componentName; for example: target=ComponentName.
Results
You have implicitly or explicitly configured the SCA default binding for the SCA service or reference.
Example
The following examples illustrate multiple scenarios for configuring the SCA default bindings.
Top level composite with SCA service binding<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://mysca/samples" name="MyComposite"> <component name="HelloWorldServiceComponent"> <implementation.java class="test.HelloWorldImpl"/> </component> </composite>
Top level composite with SCA reference binding<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://mysca/samples" name="ClientComposite"> <component name="ClientComponent"> <implementation.java class="test.GreetingsServiceImpl"/> <reference name="helloWorldService" target="TargetComponent"/> </component> </composite> OR: <?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://mysca/samples" name="ClientComposite"> <component name="ClientComponent"> <implementation.java class="test.GreetingsServiceImpl"/> <reference name="helloWorldService" target="TargetComponent/HelloWorld"/> <!-- compName/serviceName --> </component> </composite>
Top level composite with SCA service binding with transaction policy attribute defined<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://neworder/sca/jdbc" name="NewOrderComposite"> <component name="NewOrderServiceComponent"> <service name="NewOrderService" requires="propagatesTransaction.false"/> <implementation.java class="neworder.sca.jdbc.NewOrderServiceImpl" requires="managedTransaction.local"/> </component> </composite>
Top level composite with SCA service binding supporting WSDL interface<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://mysca/samples" name="ClientComposite"> <component name="ClientComponent"> <service name="HelloWorldService"> <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/> </service> <implementation.java class="test.HelloWorldImpl"/> </component> </composite>
Top level composite with SCA reference binding supporting WSDL interface<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://mysca/samples" name="ClientComposite"> <component name="ClientComponent"> <implementation.java class="test.GreetingsServiceImpl"/> <reference name="helloWorldService" target="MyServiceComponent"> <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/> </reference> </component> </composite>
Intra composite over SCA default binding<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://mysca/samples" name="Service1Composite"> <component name="HWServiceComponent"> <implementation.java class="test.HelloWorldImpl"/> <reference name="component2Ref" target="Component2"/> </component> <component name="Component2"> <implementation.java class="test.Component2Impl"/> </component> </composite>
SCA Service with workManager specified for the service<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wm="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" targetNamespace="http://mysca/samples" name="Composite2"> <component name="Component2"> <service name="OneWayService"> <!-- This service uses the @oneway annotation to specify this operation only has an input message and no output message. --> <wm:workManager value="wm/scatest"/> <!-- This service specifies a workManager where the jndiName is wm/scatest. --> </service> <implementation.java class="test.Component2Impl"/> <reference name="component3" target="Component3"/> </component> <!-- component service with @oneway (non blocking operation --> <component name="Component3"> <!-- By not defining the workManager, the SCADefaultWorkmanager that is created by the SCA runtime environment is used here. --> <implementation.java class="test.Component3Impl"/> </component> </composite>
Deploy the SCA component or application.
Subtopics
- Configure Java serialization for the SCA default binding
We can convert objects to a wire format, or serialize the objects, before transmitting them. We can serialize objects for applications that use the SCA default binding.- Configure Java serialization for the SCA default binding
You can convert objects to a wire format, or serialize the objects, before transmitting them. We can serialize objects for applications that use the SCA default binding.
Related
Specify bindings in an SCA environment
Manage policy sets
Reference:
Service Component Architecture specifications and APIs