+

Search Tips   |   Advanced Search

Web Services Business Activity support in the application server

With Web Services Business Activity (WS-BA) support in the application server, web services on different systems can coordinate activities that are more loosely coupled than atomic transactions. Such activities can be difficult or impossible to roll back atomically, and therefore require a compensation process if an error occurs.

Web services protocols are defined by the Organization for the Advancement of Structured Information Standards (OASIS) group and provide standard ways of defining web services applications, allowing the applications to operate independently of the product, platform or programming language used. The Web Services Business Activity (WS-BA) support is an implementation of the following specifications in the application server. These specifications define a set of protocols that enable web services applications to participate in loosely coupled business processes that are distributed across the heterogeneous web services environment, with the ability to compensate actions if an error occurs. For example, an application that sends an email cannot retrieve that email following a failure in the business task. However, the application can provide a business-level compensation handler that sends another email advising of the new circumstances. A business activity is a group of general tasks to link together so that the tasks have an agreed outcome.

In addition to supporting the WS-BA interoperability protocol, the application server provides a programming interface for creating business activities and compensation handlers. With this programming interface, we can specify compensation data and check or alter the status of a business activity.

We can also use this compensation facility with applications that are not web services, as long as these applications involve communication between WebSphere Application Servers only. See the related topics for more information.

We can configure the policies for the WS-BusinessActivity protocol. We can configure whether a client propagates, and a server receives, a WS-BA context. To ensure that a client always sends WS-BusinessActivity context when it makes an outbound service request, we must associate a policy set with the client, where the policy set must include the WS-Transaction policy type, and this policy type must have a WS-BusinessActivity setting of Mandatory. Alternatively, if we know that the client always invokes remote endpoints that include the WS-BusinessActivity BAAtomicOutcomeAssertion policy type attribute, we can configure the client to apply the WS-Policy configuration of the provider so that the client adopts the mandatory policy of the provider automatically.

To ensure any requests that a web services provider receives includes a WS-BusinessActivity context, we must associate a policy set with the provider, where the policy set must include the WS-Transaction policy type, and this policy type must have a WS-BusinessActivity setting of Mandatory.

To ensure that a client or provider never use WS-BusinessActivity context, we must associate a policy set with the client or provider, where the policy set includes the WS-Transaction policy type, and this policy type must have a WS-BusinessActivity setting of Never. We might use this configuration for environments where we do not want web services requests to create a tight coupling between a client and a provider, for example when there are requests between enterprises.

If no policy set is associated with a client or provider, or the WS-Transaction policy type is not included in the policy set, the default WS-Transaction behavior is used.


Application development

No specific development tasks are required for web services applications to take advantage of WS-BA.

For JAX-RPC applications, any EJB component configured to run under a BusinessActivity scope automatically propagates that scope when it makes an outbound JAX-RPC web services request. The JAX-RPC run time supports WS-BA 1.0.

For JAX-WS applications, enable WS-BA support by creating a policy set, adding the WS-Transaction policy type to the policy set, optionally configuring the policy type, and attaching the policy set to the application or client that will be involved in the WS-BA communication. The JAX-WS run time supports WS-BA 1.0, WS-BA 1.1, WS-BA 1.2, and the WS-Policy assertion for WS-BA.

When the JAX-WS run time receives an inbound request, WS-Transaction 1.0, WS-Transaction 1.1 and WS-Transaction 1.2 specification levels are supported. When an outbound JAX-WS request is sent, only one specification level can be used. If WS-Transaction WS-Policy assertions are available, either from the Web Services Description Language (WSDL) of the target web service, or from the WS-Transaction policy type of the client, the specification level that is applicable to the client and the target web service is used. For example, if the hosting environment of the target web service supports only WS-Transaction 1.0, WS-BA 1.0 is used. If both specification levels are applicable, or if no WS-Transaction WS-Policy assertions are available, the default WS-Transaction specification level that is set in the Transaction service settings is used.

The default behavior when there is no effective policy set, or when the WS-Transaction policy type is not included in the effective policy set, is as follows:


WS-Transaction policy assertions

If we configure the policies for the WS-BusinessActivity protocol for a provider, this affects the assertions includes in any WSDL generated for the web service with which the policy type is associated. The WS-Policy assertion used to describe the compensation requirements of a client or provider that uses WS-BusinessActivity is BAAtomicOutcomeAssertion. If the WS-Transaction policy type has a WS-BusinessActivity setting of Mandatory or Supports, a policy assertion is included in the WSDL.

The application server can also parse, understand, and apply such assertions in WSDL that it parses.

The following example shows WSDL where the WS-BusinessActivity BAAtomicOutcomeAssertion indicates an endpoint must be invoked with WS-BA context included in the request message, and that the context can be in WS-Transaction 1.0 or 1.1 format. There are two namespaces and two assertions; one for each WS-Transaction specification level, that use the WS-Policy ExactlyOne operator to show that the client must choose which specification level to use.

<wsdl:definitions targetNamespace="bank.example.com"
     xmlns:tns="bank.example.com"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
     xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
     xmlns:wsat11="http://docs.oasis-open.org/ws-tx/wsba/2006/06"
     xmlns:wsat10="http://schemas.xmlsoap.org/ws/2004/10/wsba"
     xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/
     oasis-200401-wss-wssecurity-utility-1.0.xsd">
     <wsp:Policy wsu:Id="BAPolicy">
         <wsp:ExactlyOne>
             <wsat11:BAAtomicOutcomeAssertion />
             <wsat10:BAAtomicOutcomeAssertion />
             <!-- omitted assertions -->
         </wsp:ExactlyOne />
     </wsp:Policy>
     <!-- omitted elements -->
     <wsdl:binding name="BankBinding" type="tns:BankPortType">
          <!-- omitted elements -->
          <wsdl:operation name="TransferFunds">
               <wsp:PolicyReference URI="#BAPolicy" wsdl:required="true"/>
               <!-- omitted elements -->
          </wsdl:operation>
     </wsdl:binding>
</wsdl:definitions>


Related:

  • Web services transactions, high availability, firewalls and intermediary nodes
  • Use WS-Transaction policy to coordinate transactions or business activities for web services
  • Transaction compensation and business activity support
  • Web Services Atomic Transaction support in the application server
  • Create an application that uses the Web Services Business Activity support
  • Configure a server to use business activity support
  • Configure the WS-Transaction policy
  • Business activity API
  • Local transaction containment
  • WS-Transaction policy settings