an honour’s project report presented in partial ful llment of the...

50
E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY by Houxiang Wang 100637028 Supervised by Dr. Tony White School of Computer Science An Honour’s Project Report Presented in Partial Fulfillment of the Requirements for the Degree Managment Business and System CARLETON UNIVERSITY August 2007

Upload: others

Post on 04-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

by

Houxiang Wang

100637028

Supervised by Dr. Tony White

School of Computer Science

An Honour’s Project Report Presented in Partial Fulfillmentof the Requirements for the DegreeManagment Business and System

CARLETON UNIVERSITY

August 2007

Page 2: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

ABSTRACT

J2EE and Web 2.0 technology have been applied in many internet application

areas. This report describes how these two technologies were used to create an e-

business website. The text will focus on analyzing the requirements of the application

and the process of designing the web application.

This project applies the latest technologies such as J2EE and Web 2.0 to create

a new Business-to-Business (B2B) and Business-to-Consumer (B2C) website. The

technology used included: Enterprise Java Bean, Servlet, CMP, Web 2.0, Ajax (Dojo),

DB2 and Java. This project incoprates the storefront business and supplier module.

The storefront as the B2C business model and supplier as the B2B business model.

The goal of this project is to apply the Web 2.0 technology providing more efficiency

as it allows the function of dragging and dropping the product items into a virtual

shopping cart.

ii

Page 3: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

ACKNOWLEDGMENTS

I would like to thank Dr. Tony White for his invaluable advices and help on

this honour project. I would like to thank Miss Marie-Lynn Bromilow help me for

this report.

iii

Page 4: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

TABLE OF CONTENTS

CHAPTER 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2. System Requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

CHAPTER 2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1. Business Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2. J2EE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3. Web 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4. SOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

5. WSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

6. Model-View-Controller Design Pattern . . . . . . . . . . . . . . . . . 7

CHAPTER 3 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1. Infrastructures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2. Context Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3. Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.1. Web Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2. BackOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4. Web Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4.1. Web Content . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4.2. Technology Strategy . . . . . . . . . . . . . . . . . . . . . . . 16

5. Database Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

iv

Page 5: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 4 System Classes Design . . . . . . . . . . . . . . . . . . . . . . 19

1. Servlet Classes Definition . . . . . . . . . . . . . . . . . . . . . . . . . 19

2. Entity Bean Classes Definition . . . . . . . . . . . . . . . . . . . . . . 21

3. Session Bean Classes Definition . . . . . . . . . . . . . . . . . . . . . 23

CHAPTER 5 Implementation Detail . . . . . . . . . . . . . . . . . . . . . . 25

1. Create the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2. Create J2EE Application . . . . . . . . . . . . . . . . . . . . . . . . . 29

3. Create EJB Web Module . . . . . . . . . . . . . . . . . . . . . . . . . 33

4. Configure Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

5. Create a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

6. Publish the Web Service . . . . . . . . . . . . . . . . . . . . . . . . . 36

CHAPTER 6 Result and Discuss . . . . . . . . . . . . . . . . . . . . . . . . 37

CHAPTER 7 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

APPENDIX A CONFIGURE AND RUN . . . . . . . . . . . . . . . . . . . . 41

1. Configure Datbase Resource . . . . . . . . . . . . . . . . . . . . . . . 42

1.1. Define the DB2 XA Provider . . . . . . . . . . . . . . . . . . . 42

1.2. Define the JAAS-J2C authentication data . . . . . . . . . . . 43

1.3. Define and associate the Data source for the OurBusiness ap-

plication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

v

Page 6: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

2. Installing the OurBusiness application on WebSphere Applications

Server 6.1 Network Deployment . . . . . . . . . . . . . . . . . . . . . 44

3. Accessing OurBusiness Application . . . . . . . . . . . . . . . . . . . 44

vi

Page 7: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 1

Introduction

In today’s global business environment, organizations need to extend their

reach, lower their costs, and lower their response times by providing services that are

easily accessible to their customers, suppliers, and other business partners. These

services must be: (1) highly available to satisfy the requirements of the business envi-

ronment; (2) Secure to protect the users and enterprise; (3) and reliable and scalable

to make sure that business transactions are accurately and promptly processed.

In most cases, these services are provided with the help of multi-tier applica-

tions with each tier serving a special purpose. The most popular technology for this

function is J2EE and .Net. .Net technology is based on Microsoft platform. How-

ever,this project is based on J2EE platform. J2EE reduces the cost and complexity of

developing these multi-tier services, resulting in services that can be rapidly deployed

and easily enhanced based on the requirements of the enterprise.

Page 8: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

2

1. Purpose

The purpose of the project is to build an e-commerce website based on the latest

technology. The production items of a traditional company e-commerce website are

very limited because they only allow buying a few manufacturers’ products. The idea

of this website is to gear towards bridging the gap between consumers and suppliers.

The suppliers could also be consumers when they are shopping on the website.The

project involves two parts storefront and supplier. The storefront is a platform that

consumers can view products detailed information, create new customer accounts and

place orders. Suppliers is a platform that allows supplier to provide products to the

storefront. This website has features that are distinct from traditional e-business

websites such as Costco and Futureshop, because it is faster to access and easier to

use.

2. System Requirement

The requirements of this website has necessary e-commerce features.

First, the storefront website can perform basic e-commerce functions. Con-

sumers are able to register online, view product detail information, place an order

and backorder items. The website displays these features using Web 2.0 technology.

Consumers are able to drag and drop product items into their shopping carts. Second,

the website facilitates opening supplier accounts. The administrator (admin) man-

ages return order. Third, the user interface must be friendly, easy to use and easy

Page 9: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

3

to understand. Fourth, the description of items is as detailed as possible, and thus

allows consumers to easily understand the functions of the item. Fifth, consumers

can make payment only by credit cards such as, American Express and VISA. Sixth,

shopping information will be verified before customers submit their orders. Seventh,

the confirmation email would be sent out after customers submit their order.

The storefront provides the information on all product items, and then cus-

tomers can lookup the available items. This storefront part is a hallmark of a good

e-commerce website. The user will come back if they had a good impression and ex-

perience on this website. The customer module includes registering new customers,

maintaining current customers and recording orders. The supplier module also con-

tains registering information, maintaining the supplier information, allowing multiple

suppliers to exist in the system.

Page 10: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 2

Background

1. Business Model

Electronic business, often known as E-Business, companies complete their busi-

ness transactions through a web application. E-business enables companies to link

internal and external information easier and faster, working with suppliers, partners

and customers.

E-Commerce is a marketplace on the internet. E-Commerce application per-

forms functions such as distribution, purchasing, selling, marketing and various ser-

vices over an electronic system and other computer networks.

E-business has two models: business to business (B2B) and business to con-

sumer (B2C). B2B is to trade between businesses and other groups. B2C is to trade

between businesses and consumers.

Page 11: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

5

2. J2EE

Java 2 Platform Enterprise Edition (J2EE) is an infrastructure of the online

application. J2EE is a platform-independent, java centric environment from Sun

Company for developing, building and deploying a web-based enterprise application

online.

J2EE contains three-tier structures: client, application server and backend

database. The client tier is based on web page technology as a user interface.

The client tier supports pure html, JSP, java applet, Ajax and other applications.

The application server provides middleware services between the client and Back-

end Database. Enterprise Java Bean (EJB) usually provides this platform’s business

logic service. An EJB provides functions such as threading and security. Backend

Database provides a storage area for all information.

This project uses container-manager persistence (CMP), container-managed

relationship (CMR), stateless session beans, a stateful session bean, JSP pages,

Servlets as well as Web 2.0. Servlet is an object that receives a request and generates

a response based on that request. It can also dynamically generate web content. The

Servlet can use the various enterprise bean methods.

3. Web 2.0

Web 2.0 is not new nor does it revolutionize the business web application, but it

has become increasingly popular in the past few years. It uses the Ajax (Asynchronous

Page 12: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

6

JavaScript and XML language). Many major websites such as Google and Amazon

use it to improve user experiences;which is the purpose of Ajax language. For instance,

it automatically refreshes the area with updated data. It can make a web page refresh

quickly and easier to use.

4. SOAP

Service Oriented Architecture Protocol (SOAP) is used to exchange XML-

based information over the internet. SOAP forms provide a basic messaging frame-

work that more abstract layers can build on and it sits on the foundation layer of Web

Services Stack. A Web service could interact with remote machines by HTTP’s post

and get methods. However, with HTTP what we are ”posting” or ”getting” from the

Web server is a text string. This is not sufficient to pass information to the server

to invoke a service, that is invoke a method on an object or invoke a function on the

server that provides a specific service. SOAP provides the means of making such a

request to a server using HTTP/SMTP as the transfer protocol.

5. WSDL

Web Services Description Language (WSDL) is an XML-based language used

to define Web Services and describe how to access them by specifying its location,

and describing the operations, that is the methods it exposes. Web Service and client

are invoking it by SOAP and HTTP GET. WSDL is often combined with SOAP

Page 13: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

7

and XML Schema to provide web services on the Internet. When a client program

connects to a web service, it can read the WSDL to decide what functions are available

on the server. In the WSDL file, any special datatypes are presented by the form

of XML Schema. This allows the client using SOAP to invoke one of the functions

listed in the WSDL.

6. Model-View-Controller Design Pattern

Model-View-Controller Design Pattern is applied in J2EE. The model in J2EE

can be created by servlet using a business object, but the model is often presented by

entity bean. The view in J2EE is presented by Web pages such as Java Server Page,

HTML and XML. The controller in J2EE is presented by a servlet.

Page 14: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 3

Analysis

1. Infrastructures

This e-business project uses a J2EE infrastructure.To design an e-business

website based on a J2EE platform, the three components should be used: a

user interface (client tier), a transaction (Enterprise Java Been) and a database.

Page 15: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

9

Page 16: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

10

2. Context Description

In this e-business application, the suppliers provide an item in the store-

front. The customers search for an item and view the detail information of the

selected item. They add the desired item into the shopping cart. The customer

can decide to check the item out if they do not want to shop anymore. The cus-

tomer can login to system or register if they are new customers. Customers have

to fill out all required information they get into the system. They must make a

payment by credit cards. At this point there are three actors: customer, supplier

and bank. The following use case diagram illustrates the context described above.

Page 17: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

11

3. Process

3.1. Web Order. There are number of processes in an e-commerce applica-

tion, but two most important processes of this basic e-business application are the web

order and the backorder. First, the web order. A customer connects to OurBusiness

home page and then links to the checkout or the login page. If this is a new customer,

he or she requests the new customer page and enters the necessary information such

as a secret password. When a customer finds some items to order, he or she can

Page 18: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

12

click to add to the shopping cart or drag the item to shipping cart. The price will

be automatically calculated after the items are added into the shopping cart. The

customer can also remove the item from the shopping cart if he/she changes his/her

mind. After the customer finishes shopping and clicks the ”Check out” button, the

system displays the payment form. At this point, the customer inputs his/her pay-

ment information. The system starts verifying the information after he/she submits

his/her order. After the order is accepted, a summary Web page is displayed and

a confirmation e-mail is sent to the customer. The order has been created by the

system. Following is the web order workflow diagram.

Page 19: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

13

Page 20: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

14

3.2. BackOrder. The backorder process allocates the expected inventory for

a specific order item at management part. If the order item is suitable for backo-

rdering, the manager completes the backorder quantity needed by the order item,

and update the order item to reflect the status. The process takes an order requiring

inventory allocation as input and determines whether or not there are line items that

are required. An item needs allocation if it is not allocated or it is allocated but the

fulfillment center, the quantity, or the ship-to-address has changed since it was last

allocated. The workflow of backorder is provided below.

4. Web Interface

4.1. Web Content. The main function of this website is e-commerce. All

designs should benefit the customers. They can easily purchase product items from

this website. The intended users of the website are adults since they are legal age to

Page 21: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

15

shop online. Therefore, the website should be as simple as possible so that all adults

at all technical level can use this website to shop.

We look at what kind of content should be included int this website. The home

page is very important for end users since they always use this particular interface.

This is an e-business website, that needs a variety of product, and therefore categories

are necessary for organization. These categories can help customers to easily find

products. The categories should be clear to customers, for instance, automotive,

computer and plants. Each category can have a few subcategories. The categories

may have a large amount of items, thus the pulldown navigation menus should be

used. This navigation menu is familiar to consumers; and make the website more

user friendly.

We need a common banner on the top of the web page so it is clear to customers

what website they are at. The Frame set is used on the home page. One frame is for

the banner and another is for the content. This way the banner is always on the top

of each webpage.

Three important display areas on the home page are as follows: (1)recom-

mended product area, (2) the on sale product area and (3) today’s new product area.

The recommended product area is generated by data analysis. These products are the

most frequent purchases on the website with no complaints. Consumers can easily

see their desired products. The onsale product area displays the current products

that are on sale, at a lower price than normal. The today’ new product area displays

Page 22: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

16

products that are provided by suppliers that day.

The online help information link should be on the home page. This help

link can assist users quickly with the advantages of this website. Users can see the

difference between this e-business website and others.

4.2. Technology Strategy. The inventory list is frequently used on this web-

site, therefore all pages should maintain the same style. It is an easy way to create the

template. It allow all pages to have the same style and reduce the amout of program-

ming code. At the same time, the Web 2.0 technology can be used. The technology

can provide the following features: customers can drag and drop the desired item

into shopping carts; the customer can scroll product lists by clicking the previous and

the next Hyperlink; the price and qualities of the products will automatically update

after customers added the item to their shopping cart or remove the item from their

shopping carts.

5. Database Schema

Based on the requirements of this e-business website, the main entities that

interact with the system are the customer and the supplier. From the workflow

of this website, suppliers provide product items; customer view detailed product

information, place their order, submit the order and backorder; and administrators

manage the inventory. Therefore, the system comes up with 7 entities: customers,

backorder, IDGenerator, Inventory, Order1, OrderItem. Customer entity contains all

Page 23: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

17

the attributes related to the customer’s information on the system. The attribute

CustomerID is a primary Key.

The Backorder entity contains all the attributes related to the inventory that

specifies each backorder. The BackorderID is a primary Key. The IDGenerator

entity contains all the attributes related to new ID that automatically generates

different types of IDs. The IDName is a primary key. Inventory entity contains all

the attributes related to the product that stored in the system. The INVENTORYID

is a primary key. Order1 entity contains all the attributes related to an accepted

order that a customer has submitted. The CustomerID is as a primary key. Supplier

entity contains all the attributes related to a new supplier that provides products for

the business. The SUPPLIERID is as a primary key. The detailed data model of

tables required by this system is provided below.

Page 24: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

18

Page 25: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 4

System Classes Design

The classes are designed for Servlet and Enterprise Java Bean (EJB). The

Servlet classes directly map as web services. The Entity Bean classes represent the

business data that is stored in the database and it provide methods to manipulate

the data based on the request passed on the Business Logical Layer.

1. Servlet Classes Definition

Servlet class allows web browsers to indirectly access enterprise bean. In other

words, the browser accesses Enterprise Java Bean through the Servlet class. Here are

four main Servlet classes.

AccountServlet

AccountServlet handles logging in, account registration, and account updates.

During a login, the Servlet performs a Customer bean findBy(). If the user ID is

found, the password is verified, and the login executes. If any other problems occur,

an error message displays to the customer. The customer information is stored in

Page 26: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

20

the HTTP Session. For the period of registration, a Login session bean creates a

new Customer account. The customer information is saved into the HTTP session.

During an account update, a login session bean updates an existing user and the

customer information in the HTTP Session is updated.

ShoppingServlet

The ShoppingServlet handles most of the interactions between the browser and

the enterprise bean. This interaction contains the inventory, the shopping cart, and

the order methods. To Select a shopping category use a Catalog session bean, to

search and display all of the relevant inventory objects. Displaying the details of an

item is also performed using a Catalog session bean to obtain information from the

Inventory CMP entity bean. Adding an item to a shopping cart create ShoppingCart

stateful session bean. A Catalog session bean obtains the Inventory information, and

places the items in the Shopping cart Bean. After inputting billing and shipping

information, the ShoppingCart Bean creates a new Order CMP entity bean. Until

finishing the checkout process, a Mailer stateless session bean is created to send a

confirmation e-mail, using the JavaMail API.

ImageServlet

The Imageservlet obtains and place product images into the database. The JSP

and HTML get an image from the database and serve back to the browser through

HTTP response.

AdminServlet

Page 27: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

21

The AdminServlet handles the requests from a user (browser) for inventory

back orders and for Inventory Reports. When a customer checks out an item, the

inventory quantity is checked. Once the inventory quantity reaches a minimum thresh-

old, the Inventory bean creates a new Backorder CMP entity bean. The administrator

of the system can process the backorder. When the request comes from backorder.jsp

page, AdminServlet create a Back Order Stock stateless session bean that will be used

to pass requests to a BackOrder CMP bean. AdminServlet backorder requests (ac-

tions) contain refresh, orderstock and update stock. The refresh action initiates the

getorderitems BackOrderStock method to retrieve the list of backorder items. The

ordestock action sends a SOAP request from the AdminServlet to the Supplier ap-

plication sendOrder method. A receiveConfirmation method in the BackOrderStock

receives a confirmation from the Supplier application SOAP request.

2. Entity Bean Classes Definition

The Entity Bean Classes is related to Database entities. These bean classes

are also called data access bean, where they manipulate data. Here are seven Entity

Bean classes.

Backorder

A Backorder entity bean includes and manages inventory backorder. This

method performs the following tasks:finding, creating, and getting data fields. This

class manipulates all Backorder data according to the request passed.

Page 28: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

22

Customer

A Customer entity bean includes and manages the account data required by

customers. This method performs the tasks such as creating, finding, and updating

customers information, as well as, verifying a password and getting Customer fields.

IDGenerator

An IdGenerator entity bean includes and manages the key information. This

method generates a new key for product items, suppliers and customers.

Inventory

An Inventory entity bean manages inventory item data. The methods used by

this bean include:finding, creating, and getting and setting data fields.

Order

An Order is entity bean includes and manages order data. This method is used

for finding, creating and getting data fields.

OrderItem

The ORDEITEM entity bean contains and manages a single order item. This

method is available for finding, creating and getting data fields.

Supplier

The Supplier entity bean contains and manages the account data need for a

supplier. This method is used for creating, finding and updating suppliers as well as

verifying a password and getting supplier fields.

Page 29: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

23

3. Session Bean Classes Definition

A session bean contains business logic. The stateless session bean is a distribute

object that allows concurrent access to the entity bean, while limiting the number of

transactions used. Here are eight stateless session beans.

BackOrderStock

The BackOrderStock session bean interacts with the Entity Bean Backorder

bean. This session bean creates and processes inventory backorder items.

Catalog

The Catalog session bean mainly accesses the Inventory entity bean. The cata-

log obtains information from one or more Inventory beans through business methods.

These methods include adding and removing an inventory item, and modifying the

existing inventory.

Login

The Login stateless session bean interact with the Customer and Supplier entity

beans. It creates and updates customer and supplier accounts.

Mailer

Mailer stateless session bean sends a confirmation email to the customer after

they have completed their order by JavaMail API.

ReportGenerator

The ReportGenerator stateless session bean interacts with the Order entity

bean. It generates reports based on information found in the orders. These reports

Page 30: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

24

contain top-selling items for a set date range and top-selling zip codes for a set data

range.

ShoppingCart

The ShoppingCart stateless session bean maintains a list of inventory items to

be purchased throughout the HTTP session. It contains business methods to add,

remove, update inventory item, and create a new Order Entity Bean when a customer

is ready to complete a purchase.

Supplier

The Supplier stateless session bean maintains a list of suppliers. It contains

business method to add, remove and modify supplier information.

Page 31: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 5

Implementation Detail

This application is developed in a special environment. Before start working

on this application, check the following system requirement.

1. Windows 2003 Server Enterprise Edition or Windows Vista 64bit.

2. Rational Application Developer 7.0, this is IBM integration Develop Environ-

ment Software.

3. IBM DB2 9.1 Enterprise Edition, this is latest IBM Universal Database 2

4. IBM Application Server 6.1 Network Deployment, this is IBM Web Application

Server.

1. Create the Database

The first step creates a database OurBusiness database in a DB2 9.1 Enterprise

Edition, and then creates seven tables under OurBusiness Database. The database ta-

Page 32: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

26

bles for this application are CUSTOMER, INVENTORY, ORDER1, ORDERITEM,

IDGENERATOR and BACKORDER. The SQL script is provided below.

Page 33: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

27

Page 34: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

28

Page 35: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

29

2. Create J2EE Application

In the application developer 7, open a new J2EE Enterprise Java Bean (EJB)

project. Now we start to create Java Entity Beans: BACKORDER, CUSTOMER,

IDGENERATOR, INVENTORY, ORDER1, ORDERITEM and SUPPLIER. The

class diagrams are provided in a later section. Once we have finished creating these

entity beans, we create eight session beans: Back order Session Bean, Catalog Session

EJB, Login Session EJB, Mailer EJB, ReportGenerator, ResetDB session EJB, Ship-

ping Cart Session EJB and Supplier EJB. The session beans diagrams are provided

in a later section.

Page 36: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

30

Page 37: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

31

Page 38: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

32

Page 39: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

33

3. Create EJB Web Module

The previous steps are on the backend of hte process. They are prepared for

this step. This step starts the frontend. In this step, we design a lot of web pages.

We design the web pages according our previous analysis. The most important page

is the home page. This is what we should focus on. We start developing some styles

for the web page and specific layout.

In this part, we use a lot of Web page language such as HTML, JSP, CSS,

Ajax, etc. We also use template technology here for itemdetail and inventoryGrid.

At this point, the Ajax (Web 2.) is used here for most web pages. A sample syntax

of Ajax is provide below.

Page 40: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

34

Page 41: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

35

4. Configure Security

For security reason, we have to add a necessary security role in this application.

This step can be completed by security editor under the EJB folder. This process

should follow the step by step prompt. We created sampleadmin role here for both

EJB module and Web module.

5. Create a Web Service

We create a web service after we have completed the previous steps. Before

creating a Web service, we create a WSDL file. The sample WSDL is provided below.

Page 42: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

36

6. Publish the Web Service

Before we publish the web service, create a new server project, and configure

the Websphere application server. The detail configuration of the Websphere Appli-

cation Server is provided the Appendix (Configure and Run). After we complete to

configure our WebSphere Application Server, then start the server. After the Web-

sphere Application started without error, we can add the Web Service to the project

and click ”publish”. There are usually errors when we publish a web service. If exist

errors, look at the error information; fix the problem according the prompt until the

published project is without errors.

Page 43: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 6

Result and Discuss

The project has completed basic e-business functions based on Web 2.0 and

J2EE technology. Customers can create a new account, update their account, add

items to shopping cart, and place the order. This system also can configure suppliers

and manage backorder. This project takes advantage of Web 2.0, J2EE, and applies

the e-business logic as well as the procedure of developing business software. This

can be a successful experience for developing business software.

Test Requirement StatusOpen and update a customer account PassVerified information that users input PassNew user login PassView product information PassAdd item into Shopping Cart PassRemove item form shopping cart PassRecord the order number PassDrag product item and drop the item into shopping Cart PassCalculate the price and quantities correct PassSend confirmation email to customer Not TestOpen a supplier account PassManage Back order Pass

Table 1. Testing Results

Page 44: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

38

This project has three challenges. First, the project uses multiple complex

applications such as Websphere Application Server, IBM DB2 and Rational Appli-

cation Developer. Before this project, we need to spend a lot of time learning these

applications. Second, we need to understand the business logic behind the e-business.

Third, the limited amount time is a key challenge since there is only three months

for this whole project including this report. Due to the time problem, some func-

tions could not be done, for example, the portal technology should be used for the

customer module and the Supplier module. The IBM Websphere Portal is a large

and a very complex software, thus there is no time to apply this technology on this

program. However, this system demonstrates how to apply J2EE, Web 2.0 and DB2

technology and certainly business logic. It is a very good experience for developing

business applications.

Page 45: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

CHAPTER 7

Future Work

This report only completes small parts of e-business based on Web 2.0, there is

a lot of works that needs to be done as commercial software. First, the website needs

a search function, the consumer can search product that he/she desires to purchase.

The website should have an online analysis function, which is for sale reports. The

web application authentication only use user name and password, for security reason,

this application should be implemented by SSL security and LDAP. If the application

is an international application, it requires a multi-language version. For now, there

is only one English version. As a commercial website, millions of customers access

the website, and there is a limitation of the website only running on one application

Server. If the application runs in a distribution environment, this needs additional

modification. For suppliers’ convenience, the application should have web interface,

so the supplier can add the product into database.

Page 46: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

REFERENCES

http://en.wikipedia.org/wiki/Web 2

http://en.wikipedia.org/wiki/E-business

http://en.wikipedia.org/wiki/J2EE

http://www.digital-web.com/articles/user interface design for web applications/

http://en.wikipedia.org/wiki/SOAP

http://www.syco.it/baf.html

http://www.ibm.com

http://www.sun.com

Page 47: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

APPENDIX A

CONFIGURE AND RUN

Page 48: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

42

This configuration of this application is kind of complex. You have to completea lot of steps. The following will show the main steps for running this application.

1. Configure Datbase Resource

Before running this program, make sure that DB2 Database has been createdand started before running this program. If the server does not have the database,you have to create one.

1.1. Define the DB2 XA Provider.

1. Start WebSphere Application Server and log into the administrative console todefine a DB2 JDBC XA provider, if one is not already defined.

2. Select Resources –¿ JDBC –¿ JDBC Providers in the left menu. TheJDBC provider encapsulates the implementation class for the specific databaseprovider.

3. Select the scope. The scope is Node=¡Node Name¿,server=¡Server Name¿.

4. Select New button.

5. For the Database type select DB2.

6. For the Provider type select DB2 Universal JDBC Driver Provider.

7. For Implementation type select XA Data source.

8. For Name type: ”DB2 Universal JDBC Driver Provider (XA)”.

9. Click Next.

10. Enter database class path information. For jar files that are location DB2 Javadirectory,

11. For native Driver: java path

12. Click Next

13. Click Finish.

14. Select Save to save directly to the master configuration.

The provider is configured. Next you create and associate OurBusiness datasource with the new provider.

Page 49: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

43

1.2. Define the JAAS-J2C authentication data.

1. Click Resources –¿ JDBC –¿ Data source in the left menu.

2. Select the scope. The scope is Node=¡Node Name¿,server=¡Server Name¿.

3. Click New to create a new data source.

4. Click create a new J2C authentication alias.

5. Click new to create a new J2C authentication data

6. For alias enter DB2Alias.

7. For user ID DB2admin or other db2 user name

8. For password enter the password of db2admin.

9. Click Apply

10. Select Save to save directly to the master configuration

1.3. Define and associate the Data source for the OurBusiness ap-plication.

1. Click Resources –¿ JDBC –¿ Data source in the left menu.

2. Select the scope. The scope is Node=¡Node Name¿,server=¡Server Name¿.

3. Click New to create a new data source.

4. For the Data source name enter OurBusinessDB.

5. For the JNDI name enter jdbc/OurBusinessDataSource.

6. Select the J2C authentication alias that created on the previous steps

7. Click Next.

8. Select Select an existing JDBC Provider radio button.

9. Select DB2 Universal JDBC Driver Provider for OurBusiness (XA) which youdefined earlier.

10. Click Next.

11. Select an existing JDBC provider.

12. For the Database name enter OurBusinessDB.

Page 50: An Honour’s Project Report Presented in Partial Ful llment of the …people.scs.carleton.ca/~arpwhite/documents/honours... · 2008-04-16 · E-COMMERCE BASED ON WEB 2.0 TECHNOLOGY

44

13. Select Driver Type 4.

14. Enter the DB2 server name: OurBusiness (uses your own db2 server name)

15. Enter port 50000

16. Click Next.

17. Click Finish.

18. Click save to save to the master configuration.

2. Installing the OurBusiness application on WebSphere ApplicationsServer 6.1 Network Deployment

1. Start the WebSphere Application Server, go to the administrative console andlog in with your user ID and password. Click Applications –¿ Install NewApplication in the left menu.

2. For the path to the new application, click Browse and locate the OurBusiness.earfile.

3. Click install.

4. Proceed through the install accepting the defaults.

5. Click Finish.

6. Click save to save to the master configuration after the application is installed.

7. To start the application after installation, Select Applications –¿ EnterpriseApplications in the left menu.

8. Select the OurBusiness application checkbox, followed by clicking Start.

3. Accessing OurBusiness Application

The URL for the application is depend on how you configure your server.Thisinformation assumes that the internal HTTP server is running on default porthttp://localhost. The port can be different depending on how you installed the appli-cation server. You can locate the HTTP port by clicking Servers, Application Serversin the left menu. Select the application server from the list. On the ApplicationServers property window, click ports to see a list of currently configured ports for theserver.