My FAQ,最新最全的IT技术FAQ
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 未整理篇 | 技术讨论
  当前位置: > 程序开发 > 编程语言 > Java > J2EE
Extend Your J2EE Applications into Web Services
作者:未知 时间:2005-08-10 20:30 出处:Java频道 责编:My FAQ
              摘要:Extend Your J2EE Applications into Web Services
any view Web services as the backbone to a new generation of cross-platform, cross-language distributed computing applications. In fact, Sun defines Web services as "a well-defined, modular, encapsulated function used for loosely coupled integration between applications or systems components."

This industry buzz explains why many businesses want to extend their existing J2EE applications to Web services applications, which would allow them to leverage the functionality of J2EE while reaping the benefits of Web services. To that end, Apache's latest SOAP engine, Apache eXtensible Interaction System (Axis), not only enables developers to build new Web service applications from scratch but also provides the infrastructure to publish existing Java classes as Web services.

This article demonstrates how to create a Web service application from an existing J2EE application using Oracle OC4J J2EE application server and Apache Axis. With downloadable source code, it provides a step-by-step tutorial for building a simple J2EE application and then Web-service enabling it with Axis.

Build a J2EE Application
Although this article uses Oracle OC4J application server, feel free to use your own app server. Without delving too deeply into the details of building a J2EE application, the sample code defines a simple session bean (MyBean.java) with two methods (click here to download the source code):


public interface MyEJB extends EJBObject {
  public String toUpperCase(String s) throws RemoteException;
  public String reverse(String s) throws RemoteException;
}

The implementation of these methods in MyEJBBean.java is straightforward:


public String toUpperCase(String s) {
	if (s==null)	  return null;
	else	  return s.toUpperCase();
}
public String reverse(String s){
 if (s==null)	  	  return null;
 else return new StringBuffer(s).reverse().toString();
}

 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 myfaq.com.cn All rights reserved. www.myfaq.com.cn 版权所有