|
|
A Tour Through WebLogic Workshop 8.1: Westside Auto Salesby Scott Semyan10/17/2003 Content provided by BEA Systems The new WebLogic Workshop 8.1 contains many new features and is a huge step forward from the earlier product. Now, in addition to Web services, you can build many other types of J2EE applications. As a way of introducing this new version, this article will show how to build an enterprise application incorporating many of the new features found in WebLogic Workshop 8.1. This article assumes a basic understanding of J2EE (Java 2 Enterprise Edition). The application we will build in this article is "Westside Auto Sales" — an end-to-end automotive sales tool. This application has several pieces illustrated in the diagram below. The core modules of the application are 1) the Web application front end, 2) the Web service for ordering more cars, and 3) the manufacturer's Web service for processing the order for more cars. These modules, in turn, call Java controls and EJBs (Enterprise Java Beans) that perform application-level tasks. The basic architecture is illustrated below.
The data flow for our application is as follows: a user comes to the Westside Auto Sales (WAS) site and views the inventory (via a NetUI grid control on a JSP populated by a database control in a Page Flow). When they see a car they like, they can buy it but they must first sign in (via integrated security). The car they purchase is then set to "Sold" status (via an Entity EJB called from a custom control), and another car of the same type is added to the database with a status of "On Order" (again, via an Entity EJB). Finally, a message is sent to the Java Messaging Service (JMS) topic (via a JMS control) to initiate ordering another car from the manufacturer. The user gets a confirmation for their purchase and then can continue shopping. Meanwhile, a message-driven EJB sees the message arrive in the WAS JMS topic and calls a method on the WAS Web service to initiate the process of ordering another car from the manufacturer. The WAS Web service first builds an "OrderCar" XML package via XMLBeans to send to the manufacturer. A request for a new car is sent to the manufacturer's Web service with the help of a Web service control. The manufacturer first decodes the XML using XMLBeans (and for Hondas, XQuery). They then add the order to their database and immediately return an order number. Later, when the car is shipped, the manufacturer's Web service calls the callback on the WAS Web service and sends the details of the car being shipped, including the final price. The WAS Web service finally uses an entity EJB to set the vehicle's actual price and mark it as available for sale. We will go through the steps of building this application from scratch, discussing how each of the parts work along the way. Data StoreBefore we start building our application, we first need to create our database and tables and add a connection pool and JMS message topic to our WebLogic Server domain. For this project, I am using Microsoft SQL Server 2000, but you can use any JDBC-compliant database. Create a new database on your database server called "WASdb" and run the following SQL script to create the necessary tables, stored procedures, and default data. Note: this script is for Microsoft SQL; you may need to modify it to work on your database.
|