Testing the transactional behavior
You can now test the transactional behavior as all the required configurations are complete.
- Go to Integration Developer and open ABCBPEL module.
- Right-click on the Component1 in the assembly diagram and select Test Component.
- Navigate to Initial request parameters enter a value of
successand invoke the request. - The business process invokes the web service (Figure 31). The transaction context is propagated to the web service, but because of the transactional qualifiers set, the web service transaction will execute in the same context as the client transaction.
- The web service reads the input parameter and subsequently adds a
row to the database. This database transaction will also run in
the client context.
Figure 31. Test Component run 1
- Verify the database that the record is entered into the database
table (Figure 32).
Figure 32. Verifying the database table
- The transaction will commit after calling Snippet1.
In this scenario, the transaction context is propagated from Process Server and the web service. The database transactions all participate in a global transaction context.
Scenario: Transaction rollback
- Go to Integration Developer and open the ABCBPEL module.
- Right-click on the Component1 in the assembly diagram and select Test Component.
- Navigate to Initial request parameters enter a value of fail and invoke the request.
- The business process invokes the web service.
- The web service reads the parameter and writes the record to the database.
- At this stage, the transaction is still active and Snippet1 is called.
- In Snippet1, the request parameter is checked and if it is “fail”, a BPEL fault will be raised.
- A ServiceRuntimeException is thrown in the business
process and this triggers the global transaction rollback, as
shown in Figure 33.
Figure 33. Test component ends in ServiceRuntimeException
- Look in the database table and you will observe that the record
is not committed to the database. There is no entry for “fail”.
Figure 34. Verify the database after the exception
In this scenario, the transaction rollback is initiated by ServiceRuntimeException raised in the business process. Since the transaction context is used by the web service and the database, the corresponding transactions at the web service and the database transaction are rolled back, thereby ensuring data integrity. ServiceRuntimeException itself is induced using a BPEL fault.





