You can configure a Service Component Architecture (SCA) Web service binding to transport SOAP messages over Java Message Service (JMS) protocol.
For information about Web service bindings, read Configuring the SCA Web service binding.
Web services technology plays an important role in most service-oriented architecture (SOA) solutions relevant today, including SCA. The Web service binding type enables SCA applications to expose services as Web services to external clients and gives SCA components access to external Web services. Using JMS as a transport for Web services provides a reliable asynchronous messaging transport for request and response.
This topic describes how to configure a Web service binding to flow SOAP messages over JMS.
You have a configured an SCA Web service binding service or reference.
Configuring a request-response Message Exchange Pattern for SOAP over JMS
This example describes a <binding.ws> element in the composite definition file for a request-response message exchange pattern from an SCA component reference to an SCA component service.
The following example shows an SCA component with a reference binding:
<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:soapjms="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" targetNamespace="http://www.ibm.com/samples/sca/mybank" name="MyBankClient"> <component name="AccountSummaryService"> <implementation.java class="samples.mybank.AccountSummaryServiceImpl"/> <reference name="accountService"> <interface.wsdl interface="http://www.mybank.com/account#wsdl.interface(AccountService)"/> <binding.ws wsdlElement="http://www.mybank.com/account#wsdl.port(AccountService/AccountServicePort)" uri="jms:jndi:jms/MyBankAccountService_Request?jndiConnectionFactoryName =jms/MyBankAccountService_CF&replyToName=jms/MyBankAccountService_Response&targetService =AccountServiceComponent/AccountService"/> </reference> </component> </composite>
The following example shows an SCA component with a service binding:
<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:soapjms="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" targetNamespace="http://www.ibm.com/samples/sca/mybank" name="MyBank"> <component name="AccountServiceComponent"> <implementation.java class="samples.mybank.AccountServiceImpl"/> <service name="AccountService"> <interface.wsdl interface="http://www.mybank.com/account#wsdl.interface(AccountService)"/> <binding.ws wsdlElement="http://www.mybank.com/account#wsdl.port(AccountService/AccountServicePort)" uri="jms:jndi:jms/MyBankAccountService_Request?" soapjms:activationSpec="jms/MyBankAccountService_AS" soapjms:responseConnectionFactory="jms/MyBankAccountService_CF"/> </service> </component> </composite>
You can use these composite definition examples for @OneWay Message Exchange Pattern. When using @OneWay, the reference binding URI does not need to specify replyToName because there is no reply for the @OneWay call.
Configuring an SCA callback for SOAP over JMS
This example describes a <binding.ws> element in the composite definition file for a callback message exchange pattern between an SCA component reference and an SCA component service.
The following example shows an SCA component with a reference binding:
<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:soapjms="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" targetNamespace="http://www.ibm.com/samples/sca/mybank" name="MyBankClient"> <component name="AccountSummaryService"> <implementation.java class="samples.mybank.AccountSummaryServiceImpl"/> <reference name="accountService"> <interface.wsdl interface="http://www.mybank.com/account#wsdl.interface(AccountService)" callbackInterface="http://www.mybank.com/account#wsdl.interface(AccountServiceCallback)" /> <binding.ws wsdlElement="http://www.mybank.com/account#wsdl.port(AccountService/AccountServicePort)" uri="jms:jndi:jms/MyBankAccountService_Request?jndiConnectionFactoryName =jms/MyBankAccountService_CF&replyToName=jms/MyBankAccountService_Response&targetService=AccountServiceComponent/AccountService"/> <callback> <binding.ws wsdlElement="http://http://www.mybank.com/account#wsdl.binding(AccountServiceCallback)" uri="jms:jndi:jms/MyBankAccountService_Callback?jndiConnectionFactoryName =jms/MyBankAccountService_CF&replyToName=jms/MyBankAccountService_Response&targetService=AccountServiceComponent/AccountService" soapjms:activationSpec="jms/$MyBankAccountService_Callback_AS" soapjms:responseConnectionFactory="jms/MyBankAccountService_CF"/> </callback> </reference> </component> </composite>
targetService is the target service to which a message is delivered. In a forward call from a service to a reference, specify the targetService in the format serviceComponentName/serviceName. In the callback URI, specify the targetService in the format referenceComponentName/referenceName.
The following example shows an SCA component with a service binding:
<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:soapjms="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" targetNamespace="http://www.ibm.com/samples/sca/mybank" name="MyBank"> <component name="AccountServiceComponent"> <implementation.java class="samples.mybank.AccountServiceImpl"/> <service name="AccountService"> <interface.wsdl interface="http://www.mybank.com/account#wsdl.interface(AccountService)" callbackInterface="http://www.mybank.com/account#wsdl.interface(AccountServiceCallback)"/> <binding.ws wsdlElement="http://www.mybank.com/account#wsdl.port(AccountService/AccountServicePort)" uri="jms:jndi:jms/MyBankAccountService_Request?jndiConnectionFactoryName =jms/MyBankAccountService_CF&replyToName=jms/MyBankAccountService_Response&targetService=AccountServiceComponent/AccountService" soapjms:activationSpec="jms/MyBankAccountService_AS" soapjms:responseConnectionFactory="jms/MyBankAccountService_CF"/> <callback> <binding.ws wsdlElement="http://http://www.mybank.com/account#wsdl.binding(AccountServiceCallback)"/> </callback> </service> </component> </composite>
The service binding callback element does not need to specify a JMS endpoint URI because the callback URI is derived from the reference binding.
In some examples, the uri value is shown on multiple lines for publication. In your composite definition, place the uri value on one line.
Deploy the SCA composite in an application and test the flow of messages over the Web service binding.
In this information ... | IBM Redbooks, demos, education, and more(Index) |