Configuring Java serialization for the SCA default binding

You can convert objects to a wire format, or serialize the objects, before transmitting them. You can serialize objects for applications that use the Service Component Architecture (SCA) default binding.

About this task

When using the default binding, objects are serialized to one of several wire formats before being sent. By default, objects are serialized to XML and sent as text over the wire. However, XML serialization occurs only with classes that are JAXB serializable. These classes require a default, no-argument constructor as well as getter and setter methods for each field.

To use non-JAXB serializable objects, you must specify a different wire format in the composite definition file. Specify the default binding element wireFormat.javaObject as a child element.

Figure 1. For non-JAXB serializable objects, use the wire format javaObject for the SCA default binding
For non-JAXB serializable objects, use the wire format javaObject for the SCA default binding

When wireFormat.javaObject is used, objects use Java serialization instead of XML and travel as a stream of bytes over the wire. This enables you to use, for example, non-JAXB serializable Enterprise JavaBeans with the default binding.

Procedure

  1. Open an editor on the composite definition file for your SCA application.
  2. Add Java serialization in the default binding of the composite definition file.
    1. Add the product SCA namespace to the composite:
      <composite xmlns:sca="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06">
    2. For each service or reference <binding.sca> element, add a wireFormat.javaObject child element using that namespace:
      <sca:wireFormat.javaObject/>
  3. Save the changes to the composite definition file.

Results

You have configured Java serialization over the default bindings for your SCA service or reference.

Using the incorrect wire format might cause a runtime exception in your application.

Example

The following composite definition file configures Java serialization in the SCA default binding:

<?xml version="1.0" encoding="UTF-8"?>

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
      targetNamespace="http://scajavaserialize"
      xmlns:sca="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06"
      name="sca-java-serialize-backend">

  <component name="SCAJavaSerializationBackendComponent">
    <implementation.java class="test.bindings.sca.SerializeBackendImpl"/>

    <service name="SerializeBackendService">
      <interface.java
         interface="test.bindings.sca.SerializeBackendService"
         callbackInterface="test.bindings.sca.SerializeCallback">
      <binding.sca>
         <sca:wireFormat.javaObject/>
      </binding.sca>

      <callback>
         <binding.sca>
            <sca:wireFormat.javaObject/>
         </binding.sca>
      </callback>
    </service>

  </component>

</composite>

What to do next

Deploy your SCA component in an application.




In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms of Use | Feedback

Last updatedLast updated: Sep 19, 2011 4:16:02 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-base-dist&topic=tsca_default_binding_serial
File name: tsca_default_binding_serial.html