About the SCA Nodes sample

The SCA Nodes sample consists of two message flows which:

The extended sample features an extra message flow which:

The following overview diagram shows the relationships between the message flows on WebSphere Message Broker and the business process on WebSphere Process Server.

Diagram to show relationship between WebSphere Message Broker and WebSphere Process Server

  1. A Web browser starts the process by sending a request to the BankTransferRequestInitiator message flow on WebSphere Message Broker.
  2. The BankTransferRequestInitiator message flow sends an HTML input form to you.
  3. You submit the form data to a second message flow, BankTransferRequest, on WebSphere Message Broker.
  4. The BankTransferRequest message flow primes the data that you submitted to send as a request to the SavingsAccount business process on WebSphere Process Server.
  5. The SavingsAccount business process updates the savings account balance and returns the response to the BankTransferRequest message flow.
  6. The BankTransferRequest message flow returns this response to the Web browser.
  7. The extended sample introduces a linked current account to the savings account. The SavingsAccount business process primes data to send as a request to the CurrentAccount message flow on WebSphere Message Broker.
  8. The CurrentAccount message flow updates the current account balance and returns the response to the SavingsAccount business process.

The bank transfer request initiator

This simple message flow comprises the following nodes:

Message flow for transfer request initiator

The broker receives a request in the form of a URI from a browser client by using the HTTP transport.

The JavaCompute node:

  1. Reads the appropriate balances from the file system
  2. Creates the message body that displays the account balances along with an HTML input form with all the fields that are required to send a transfer request to WebSphere Process Server
  3. Changes the content type of this message to text or HTML, which is then sent as the response to the request

The bank transfer request

From the browser client, choose the type of transfer request, enter the amount of money to transfer, click Submit.

Submitting the form posts these property values, by using HTTP, to another message flow listening on the HTTP port.

This message flow comprises the following nodes:

Message flow for bank transfer request

The message flow receives the property values as MIME message parts.

A JavaCompute node processes these property values by creating a XML request message from the amount and overriding the Local Environment SCA operation with the transfer request type.

The request identifier is copied to the user context so that it is not lost when the response message arrives at the SCA Asynchronous Response node. This identifier is required to reply back to the originating client.

The transfer can also be validated at this stage. If an invalid or blank amount is specified, an MbUserException is generated. If validation fails, the user exception is propagated through the Failure terminal. The exception message is included in a reply message to the originating client. Click OK to be routed back to the bank transfer form so that a correct amount can be specified.

If validation is successful, the XML transfer request message is propagated to an SCAAsyncRequest node. This node sends the message to the specified SCA service that is hosted by WebSphere Process Server. This SCA service contains the business logic related to savings account processing.

After the request has been processed, an XML transfer response message is sent back to WebSphere Message Broker where it is processed by the corresponding SCAAsyncResponse node. If the bank transfer request was successfully processed, the new savings balance is included in the reply message. If the bank transfer request was unsuccessful, the previous savings balance is used.

The request identifier is also retrieved from the local environment and copied to the Destination folder so that the reply message can be sent back to the originating client.

The savings account

The savings account is hosted on WebSphere Process Server. It comprises:

These components are connected in an assembly diagram:

Savings account assembly diagram

The implementation of the business process is split into two parts corresponding to the two operation requests:

Business process diagram for savings account

If the incoming XML message request is to transfer to the savings account, the business process variables are initialized from this message. The savings balance is read from a file by using a Java interface and credited by the requested amount. This new balance is then written back to the file by using the Java interface, a message response is created with the relevant values filled in from the business process variables and sent back to the caller.

If the incoming XML message request is to transfer to the current account, the business process variables are initialized from this message. The savings balance is read from a file by using a Java interface and debited by the requested amount. If the new balance is greater than or equal to zero, the new balance is written back to the file by using the Java interface. If the new balance is less than zero, the previous balance remains in the file. A message response is created with the relevant values filled in from the business process variables and sent back to the caller.

Back to sample home