您的位置:首页 >> 编程开发 >> Java >> J2EE >> 正文
RSS
 

Develop Web Services Clients @ JDJ

http://www.rdxx.com 05年08月10日 20:13 Java频道 我要投稿

关键词: Web Services , JDJ , Client , IE , CE , NT , Web

Interoperability is the key to using Web services architecture since many applications can collaborate to maximize business functions. With the capability of creating an application on a different architecture, including the application architecture, hardware infrastructure, and even the operating system, Web service architecture is the bridge to optimizing the IT Department.

In this article we will create a simple Web service using an EJB application and we will create a Flash MX project as a Web service client interface. We will use Websphere SDK v5.0.1 for the server-side scenario and Macromedia Flash MX 2004 for the client side. The complete source code for this article can be downloaded from www.sys-con.com/websphere/sourcec.cfm.

Prerequisites
You will need the Windows system that installed Macromedia Flash MX 2004, and you will also need an operating system (Windows or Linux) on which you have installed WebSphere SDK Web Service 5.0.1.

Server-Side Scenario
Creating a Simple Web Service from an EJB Application

First, create the J2EE Enterprise Application Project - for this article, we named it MATHServices.

Next, open J2EE Perspective from Window > Open perspective > other > J2EE. Then open J2EE Hierarchy and expand the EJB Modules; you will see the MATHServicesEJB Project as shown in Figure 1.

Create the Session Enterprise Bean at MATHServiceEJB Project (MathOperation)
Create the session enterprise bean called MathOperation and enter the following properties (see Figure 2):

  • Bean name: MathOperation
  • Source folder: ejbModule
  • Default package: com.math.service
Add the logic function in MathOperationBean. Click at MathOperationBean class; then put the following code to that class:

public String ApplicationInfo(String strUserName) { return "Hello " + strUserName + " Welcome to Math Operation Service"; } public Integer Multiply(Integer a, Integer b) { return new Integer(a.intValue() * b.intValue()); } public Integer Add(Integer a,Integer b) { return new Integer(a.intValue() + b.intValue()); } public Integer Substract(Integer a, Integer b) { return new Integer(a.intValue() - b.intValue()); }


Now you are ready to move to the outline perspective and promote ApplicationInfo, Multiply, Add, and Subtract method to the remote interface (see Figure 3).

Finally deploy the code for the MathOperationEJB (see Figure 4).

Generate a Web Services WSDL
Expand MathOperationEJB and right-click MathOperation session bean and start Web Services > Generate WSDL File (see Figure 5).

Enter the following properties from the Web Service Deployment Settings screen:

  • Web service deployment environment selection: Use Default
  • Web project: MATHServicesWeb
Click Next. On the Web Service EJBConfiguration screen, configure the enterprise bean as a Web service, click Next (see Figure 6).

On the next screen we will configure the JavaBean as a Web service (see Figure 7). Use the default parameter from Websphere (configure the JavaBean as a Web service). The following parameter is:

9 7 3 1 2 3 4 8 :

 
 
标签: Web Services , JDJ , Client , IE , CE , NT , Web 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站