Figure 13-5 shows the business flow of the Retailer - Supplier transactions. These transactions are summarized here.
The detailed transactions and how to run the B2B XML application is provided in "Running the B2B XML Application: Detailed Procedure" .
1 Retailer Browses the Supplier's OnLine "Hi-Tech Mall" Catalog
The following Retailer transactions occur:
- The Retailer logs in from their web site using XSL Servlet.
- Retailer browses the Supplier's on-line catalog. Retailer selects a product and quantity.
2 Retailer Places Order
When the Retailer places the order, the Retailer then needs to either confirm the order and cost, by clicking on "Place Order", or cancel "Give Up" the order.
3 Retailer Confirms and Commits to Sending the Order
If Retailer confirms the order by clicking on, "Place Order", this triggers the generation of an XML document containing the order data. The Retailer application sends this XML order document to the Supplier by way of the AQ Broker-Transformer application.
The Action Handler "XSQL Script Example 5: Starts B2B Process -- placeorder.xsql" of the XSQL Servlet is the key component in the whole process. It ensure that this transaction is inserted into the retailer database table, Ord.
The Action Handler also sends the XML order on to the AQ Broker-Transformer.
4 AQ Broker-Transformer Transforms the XML Document According to the Supplier's Format
When the AQ Broker-Transformer receives the XML document the following actions transpire:
- The AQ Broker-Transfomer waits for the queue [READS] from the Retailer that they have sent an order. See Figure 13-6.
Figure 13-6 B2B XML Application: AQ Messaging Flow
The AQ Broker receives the XML document order message, and determines the following information from the message:
The AQ Broker-Transformer refers to the Stylesheets table and according to the From, To, and Task criteria, selects the appropriate XSL stylesheet. The stylesheets are stored in CLOBs in the Stylesheets table in the XSL column. AQ Broker-Transformer accesses the database and stylesheets by means of JDBC.
- FROM: From where the message is coming (from which Retailer)
- TO: To where the message is going (to which Supplier)
- OPERATION or TASK: What operation is needed to process this message
XSL-T Processor is informed by AQ Broker-Transformer application to apply the selected and retrieved XSL stylesheet to the XML document containing the order data. The XSL-T Processor outputs the reformatted XML order.
AQ Broker-Transformer uses AQ to send [WRITE] the transformed XML document to the "TO" Supplier destination.
If a DTD (XML Schema) is used, it would be applied before processing in the AQ Broker phase. In this example, for simplicity, we assume that the document is always sent in the same format.
The schema used by the AQ Broker-Transformer is shown inFigure 13-4.
5 Supplier Application Parses Incoming Reformatted XML Order Document. Inserts Order into the Supplier Database
When the Supplier receives the reformatted XML order document from the AQ Broker-Transformer, the following protocols transpire:
- The Supplier waits for the queue from the AQ Broker-Transformer that a order is pending from a Retailer. The Supplier dequeues the AQ message.
- The Supplier parses the XML document and INSERTs the order into the Supplier database by means of JDBC.
6 Supplier Application Alerts Supplier of Pending Order
When the Supplier application has inserted the XML document into the Supplier database the following actions transpire:
- Supplier Application Alerts the Supplier of the Order. The order status is kept at "pending".
- The Supplier, after checking if the product(s) ordered are available, and the Retailer's credit, decides to ship the product(s). Supplier clicks on "Ship".
- The Supplier application updates the Supplier database Ord table's status column to "shipped".
7 AQ Broker-Transformer Transforms the XML Order According to Retailer's Format
- AQ Broker-Transformer waits [READS] for a queue from the Supplier.
- When the XML Order Shipped document is received, the AQ Broker-Transformer refers to the Stylesheets table in the Transformer database, and according to the From, To, and Task criteria, selects the appropriate XSL stylesheet. The stylesheets are stored in CLOBs in the Stylesheets table in the XSL column. AQ Broker-Transformer accesses the database and stylesheets by means of JDBC.
- AQ Broker-Transformer uses AQ to send [WRITE] the reformatted XML order update document to the "TO" Retailer destination.
8 Retailer Application Updates the Ord and Line_Item Tables
- Retailer application updates the Retailer database with new "shipped" order status information. The Ord table is updated.
- This information is viewed by the Retailer from any device. The status is seen as "Shipped".