Invoking web service requests transactionally using SOAP over JMS transport
Use the enableTransactionalOneWay property to ensure that one-way and two-way asynchronous web service requests using the industry standard SOAP over JMS transport will be sent to the destination queue or topic transactionally.
When using JMS to transport Java API for XML Web Services (JAX-WS) or Java API for XML-based RPC (JAX-RPC) web service requests, the default behavior is for the SOAP message to be added to the destination queue or topic non-transactionally or outside of the client application's transaction. Adding the SOAP message to the destination queue or topic is done outside of the transaction to avoid synchronization problems that can occur with two-way synchronous web service requests. However, we can choose to enable one-way and two-way asynchronous requests to be processed as part of a transaction. We can use the enableTransactionalOneWay property to ensure that one-way and two-way asynchronous web service requests that use the JMS transport are sent to the destination queue or topic transactionally. When the client application invokes the web service request, the resulting SOAP request message is added to the destination queue or topic as part of the client application's transaction.
Use one of the following ways to enable the enableTransactionalOneWay property.
- Set the enableTransactionalOneWay property programmatically. The value of the property is a Boolean.
- For JAX-WS clients, set the property on the client JAX-WS RequestContext object. For example:
((BindingProvider) port).getRequestContext().put (com.ibm.websphere.webservices.Constants.ENABLE_TRAN_ONEWAY, new Boolean(true));
- For JAX-RPC clients, set the property on the client JAX-RPC Stub or Call object. For example:
stub._setProperty(com.ibm.websphere.webservices.Constants.ENABLE_TRAN_ONEWAY, new Boolean(true));
- For JAX-RPC clients, set the enableTransactionalOneWay property as a custom property in the ibm-webservicesclient-bnd.xmi deployment descriptor file using wsadmin.
For more information about wsadmin.sh options, see the options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands information..
Use the $AdminApp object along with the -WebServicesClientCustomProperty option to set the value of the property within the client binding file, ibm-webservicesclient-bnd.xmi. The value of the custom property, enableTransactionalOneWay, is either true or false.
- Jacl:
$AdminApp edit MyApplication {-WebServicesClientCustomProperty {{MyEJBJar.jar MyEJB service/MyServiceRef MyPort enableTransactionalOneWay true}}}
- Jython:
AdminApp.edit('MyApplication', ['-WebServicesClientCustomProperty', [['MyEJBJar.jar', 'MyEJB', 'service/MyServiceRef ', 'MyPort', 'enableTransactionalOneWay', 'true']]])
Results
You have a web services client application configured to invoke one-way and two-way asynchronous requests transactionally when using the JMS transport.
What to do next
After we have enabled the enableTransactionalOneWay property, run the client application.
Related tasks
Use SOAP over JMS to transport web services Task overview: Implement web services applications
Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands
Related information:
SOAP over JMS protocol