当前位置:编程学习 > JSP >>

Study on Applying Web Services in Mobile E-business

答案:

1. Introduction

In today's e-business world, the use of mobile technologies is steadily on the increase. The next generation e-business will be mobile e-business.

Meanwhile, the current trend in the application space is moving away from tightly coupled monolithic systems and towards systems which are loosely coupled, dynamically bound components. Web service is the next stage of the evolution for e-business. The web service architecture provides several benefits such as promoting interoperability, enabling just-in-time integration, reducing complexity by encapsulation and enabling interoperability of legal applications.

Web service has evolved to its maturity period. With the potential market in mobile e-business growing rapidly, the demand for access to digital information using web services from mobile devices emerges.

J2ME is targeted to devices with limited horsepower and is supported by 90% of new

devices released to the market. J2ME has a runtime environment that provides a secure, portable platform and a very large developer community. Soft companies have done much to provide J2ME devices the ability of accessing web services and several products had been published (such as kSOAP).

However, these developers’ packs are not standard APIs on J2ME. Developers who want to use web services on J2ME platform have to embed these packs in each application an especially expensive proposition in resource-constrained devices like mobile telephones and personal digital assistants.

Fortunately, JCP(Java Community Process) has released WSA1.0(JSR172) just recently. The goal of WSA is to integrate fundamental support for web services invocation and XML parsing into the device's runtime environment, so developers don't have to embed such functionality in each application.

 

The “Bid-joy” mobile auction system, a typical case of mobile e-business, is built with web services in a standard way. It applies the newly released WSA1.0 API to achieve accessing web services on mobile devices. It’s ready to be put to market and just waiting for devices that support the WSA API.

2. Requirements Analysis and Summary Design of ‘Bid-joy’ System

2.1 Technology Scheme

  This system is developed by using Java language, so the operating system which runs on different servers and clients is not restricted. For example, the database server and the application server can run on Linux or Windows operating system.

  This system adopts IBM Universal Database as the database server and WebSphere Application Server as the application server. The mobile client is developed by using J2ME technology and the administrator manages the system through the browser.

2.2 The Structure of ‘Bid-joy’ System

(1)        Register and mange the user: allow the new user to register and update some parts of the user’s information.

(2)        Manage and book the goods: import goods records into the database and specify how to bid.

 

(3)        The biding module: manage the goods according to the established biding strategy.

 

(4)        Report the biding event: deal with the query submitted by the client and remind the client about the biding activity automatically.

 

2.3 Function Design

The functions in the client include:

(1)        Browse the goods by classification

 

(2)        Search the goods

 

(3)        Bid for the goods

 

(4)        Sell the goods

 

(5)        Register

 

2.4 Database Design

  This system contains four tables:

 

(1)         User table: record the user’s information

 

(2)         Article table: record the detail information of the goods

 

(3)         Classtree table: classify the goods and store the goods by tree

 

(4)         Bid table: record the price that has been paid by the bider

 

3. The Design and Implement of ‘Bid-joy’ System

3.1 Accessing Database

 This system uses JDBC 3.0 to access DB2 database. First you have to deploy the JDBC data source. Second you have to acquire the object of database, the code is described as follows:

 

javax.naming.Context ctx = new javax.naming.InitialContext();

javax.sql.DataSource ds =(javax.sql.DataSource)ctx.lookup(

“java:comp/env/jdbc/m-auction”);

 

   And you can use the sentence ‘java.sql.Connection con = ds.getConnection();’ to get the connective object. After that, you can submit the SQL query. Finally you have to call the ‘con.close()’ method to close the connection.

This system uses DAO(Data Access Object) mode to access the database, every DAO class is in the package called ‘cn.edu.scu.mauction.dao’.

3.2 Developing and Publishing Web Services

  This system adapts WAS to publish web services and I develop the classes which provide web services and then use WAS to publish web services.

  The classes implementing web services are encapsulated in the package called ‘cn.edu.scu.mauction.ws’ and every class provides a ‘public’ method. These classes include ‘User’, ‘Article’, ‘ClassTree’, ‘Bid’ and ‘MyX’ that provide different access entries.

3.3 Calling Web Services by J2ME client

  I choose ‘JSR 172’ standard to connect to the server to access web services. WTK2.1 gives better support to JSR 172 and the ‘stub generator’ in it can generate a proxy class accessing the web service basing on a WSDL file. When the proxy class has been generated, you can use it to access the web service. For example, if you want to create a proxy object according to ‘User’ web service that has been published, you can use the following sentence:

User_PortType user = new User_PortType_Stub();

3.4 Development of the J2ME Client

  The whole client is a MIDlet suit and the related class is put into the ‘cn.edu.scucdut.mauction.j2meclient’ package. MainMIDlet is the MIDlet class in the suit and MainForm is the main interface.

  When programming the client, I meet many difficulties, for example, ‘back the interface ’, ‘deal with the pause when one thread has been terminated’, ‘define the message code’. Besides these, I have to consider some special instances. I have to reduce the delay of the network because the clie

上一个:Eclipse Release Build: 3.1正式发布! ——JDT新特性(一)
下一个:配置iis和resin1.1

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,