Configure JMS binding request and response wire formats
We can configure the messaging data formats between an SCA application and a JMS producer or consumer, by configuring your SCA application to take advantage of a supported message type and data format. In general, each wire format can map to the service or reference side, and even into serialization and deserialization. As a result, we can configure each service or reference request and response to use different wire formats.
Configure the JMS binding for the SCA application. Then, configure the JMS binding wire format. The product supports both the OASIS and the OSOA SCA JMS binding specification. Unless otherwise specified, the information in this topic pertains to applications for both the OSOA and OASIS specification.
In most cases, the response wire format can be the same as the request wire format for a messaging application. However, in certain scenarios this might not be reasonable, such as when the inputs and outputs of an operation cannot use the same wire format. In this situation, we can override the request wire format by explicitly configuring the response wire format with a wireformat element as a child on the binding.jms response element.
When choosing a request and response wire format, consider any restrictions imposed by the application itself and also the limitations of any particular wire format. For example, consider the following interface method:
public MyJavaObject method(MyJAXBObject mjo)
MyJavaObject is not an XML-serializable object and MyJAXBObject is not Java-serializable so we cannot use only one wire format. However, we can use wireFormat.jmsTextXML for the request wire format and wireFormat.jmsObject for the response.
- Open an editor on a composite definition file and configure a reference-side wire format.
A reference-side wire format resembles the following:
OSOA
<component name="JAXBJMSFrontendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.frontend.HelloWorldJAXBFrontendImpl"/> <reference name="hwJAXBService"> <interface.java interface="com.ibm.test.soa.sca.HelloWorldJAXBService"/> <binding.jms> <destination name="jms/SCA_JMS_Request1"/> <connectionFactory name="jms/SCA_JMS_CF"/> <response> <destination name="jms/SCA_JMS_Response1"/> <connectionFactory name="jms/SCA_JMS_CF"/> <ts:wireFormat.jmsObject/> </response> </binding.jms> </reference> </component>OASIS
<component name="JAXBJMSFrontendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.frontend.HelloWorldJAXBFrontendImpl"/> <reference name="hwJAXBService"> <interface.java interface="com.ibm.test.soa.sca.HelloWorldJAXBService"/> <binding.jms> <destination jndiName="jms/SCA_JMS_Request1"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> <response> <ts:wireFormat.jmsObject/> <destination jndiName="jms/SCA_JMS_Response1"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> </response> </binding.jms> </reference> </component>In the example component configuration, the binding level wire format is the default because no wire format is specified. However, the response wire format is overridden by the jmsObject wire format.
- Open an editor on a composite definition file and configure a service-side wire format.
A service-side wire format resembles the following:
OSOA
<component name="JAXBJMSBackendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.backend.HelloWorldJAXBBackendImpl"/> <service name="HelloWorldJAXBService"> <interface.java interface="com.ibm.test.soa.sca.HelloWorldJAXBService"/> <binding.jms> <destination name="jms/SCA_JMS_Response1"/> <activationSpec name="jms/SCA_JMS_AS1"/> <response> <destination name="jms/SCA_JMS_Response1"/> <connectionFactory name="jms/SCA_JMS_CF"/> <ts:wireFormat.jmsObject/> </response> </binding.jms> </service> </component>OASIS
<component name="JAXBJMSBackendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.backend.HelloWorldJAXBBackendImpl"/> <service name="HelloWorldJAXBService"> <interface.java interface="com.ibm.test.soa.sca.HelloWorldJAXBService"/> <binding.jms> <destination jndiName="jms/SCA_JMS_Response1"/> <activationSpec jndiName="jms/SCA_JMS_AS1"/> <response> <ts:wireFormat.jmsObject/> <destination jndiName="jms/SCA_JMS_Response1"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> </response> </binding.jms> </service> </component>The response wire format is always the same as the request wire format unless the response level wire format is explicitly configured.
Results
You have configured the request and response wire format for a messaging application.
Examples
More example component configurations that show request and response wire formats follow.
Component configuration for a multiple-parameter reference
OSOA
<component name="MultipleParameterFrontendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.frontend.MultipleParameterFrontendImpl"/> <reference name="mpService"> <interface.java interface="com.ibm.test.soa.sca.MultipleParameterService"/> <binding.jms> <destination name="jms/SCA_JMS_Request2"/> <connectionFactory name="jms/SCA_JMS_CF"/> <response> <destination name="jms/SCA_JMS_Response2"/> <connectionFactory name="jms/SCA_JMS_CF"/> <ts:wireFormat.jmsObject/> </response> <ts:wireFormat.jmsObject/> </binding.jms> </reference> </component>OASIS
<component name="MultipleParameterFrontendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.frontend.MultipleParameterFrontendImpl"/> <reference name="mpService"> <interface.java interface="com.ibm.test.soa.sca.MultipleParameterService"/> <binding.jms> <ts:wireFormat.jmsObject/> <destination jndiName="jms/SCA_JMS_Request2"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> <response> <ts:wireFormat.jmsObject/> <destination jndiName="jms/SCA_JMS_Response2"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> </response> </binding.jms> </reference> </component>Component configuration for a multiple-parameter service that uses jmsBytesXML wire format
OSOA
<component name="MultiParameterJMSBackendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.backend.MultipleParameterBackendImpl"/> <service name="MultipleParameterService"> <interface.java interface="com.ibm.test.soa.sca.MultipleParameterService"/> <binding.jms> <destination name="jms/SCA_JMS_Request2"/> <activationSpec name="jms/SCA_JMS_AS2"/> <response> <destination name="jms/SCA_JMS_Response2"/> <connectionFactory name="jms/SCA_JMS_CF" create="never"/> <ts:wireFormat.jmsBytesXML/> </response> </binding.jms> </reference> </component>OASIS
<component name="MultiParameterJMSBackendReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.backend.MultipleParameterBackendImpl"/> <service name="MultipleParameterService"> <interface.java interface="com.ibm.test.soa.sca.MultipleParameterService"/> <binding.jms> <destination jndiName="jms/SCA_JMS_Request2"/> <activationSpec jndiName="jms/SCA_JMS_AS2"/> <response> <ts:wireFormat.jmsBytesXML/> <destination jndiName="jms/SCA_JMS_Response2"/> <connectionFactory jndiName="jms/SCA_JMS_CF" create="never"/> </response> </binding.jms> </reference> </component>Component configuration for a reference that uses jmsText wire format for the response and a jmsCustom format for the binding
OSOA
<component name="FrontEndWireFormatHandlerReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.frontend.CustomReqRespFrontEndComponent"/> <reference name="frontEnd"> <binding.jms> <destination name="jms/SCA_JMS_Request3"/> <connectionFactory name="jms/SCA_JMS_CF"/> <response> <destination name="jms/SCA_JMS_Response3"/> <connectionFactory name="jms/SCA_JMS_CF"/> <ts:wireFormat.jmsText/> </response> <ts:wireFormat.jmsCustom class="com.ibm.test.soa.sca.frontend.custom.FrontEndReqRespWireFormatHandler"/> </binding.jms> </reference> </component>OASIS
<component name="FrontEndWireFormatHandlerReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.frontend.CustomReqRespFrontEndComponent"/> <reference name="frontEnd"> <binding.jms> <ts:wireFormat.jmsCustom class="com.ibm.test.soa.sca.frontend.custom.FrontEndReqRespWireFormatHandler"/> <destination jndiName="jms/SCA_JMS_Request3"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> <response> <ts:wireFormat.jmsText/> <destination jndiName="jms/SCA_JMS_Response3"/> <connectionFactory jndiName="jms/SCA_JMS_CF"/> </response> </binding.jms> </reference> </component>Component configuration for a service that uses jmsText wire format for the response and a jmsCustom format for the binding
OSOA
<component name="BackEndWireFormatHandlerReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.backend.CustomReqRespBackEndComponent"/> <service name="CustomReqResp"> <binding.jms> <destination name="jms/SCA_JMS_Request3" type="queue" create="never"/> <activationSpec name="jms/SCA_JMS_AS3"/> <response> <destination name="jms/SCA_JMS_Response3"/> <connectionFactory name="jms/SCA_JMS_CF" create="never"/> <ts:wireFormat.jmsText/> </response> <ts:wireFormat.jmsCustom class="com.ibm.test.soa.sca.backend.custom.BackendReqRespDBH"/> </binding.jms> </service> </component>OASIS
<component name="BackEndWireFormatHandlerReqRespWFComponent"> <implementation.java class="com.ibm.test.soa.sca.backend.CustomReqRespBackEndComponent"/> <service name="CustomReqResp"> <binding.jms> <ts:wireFormat.jmsCustom class="com.ibm.test.soa.sca.backend.custom.BackendReqRespDBH"/> <destination jndiName="jms/SCA_JMS_Request3" type="queue" create="never"/> <activationSpec jndiName="jms/SCA_JMS_AS3"/> <response> <ts:wireFormat.jmsText/> <destination jndiName="jms/SCA_JMS_Response3"/> <connectionFactory jndiName="jms/SCA_JMS_CF" create="never"/> </response> </binding.jms> </service> </component>
What to do next
Deploy and test the wire format configuration in our SCA application.
Related tasks
Configure SCA JMS binding wire formats Configure the SCA JMS binding
Service Component Architecture specifications and APIs