Browse DevX
Sign up for e-mail newsletters from DevX


Extend Your J2EE Applications into Web Services

Web services are here. It's time to extend your J2EE applications. Apache Axis allows you to Web-service enable existing J2EE applications without touching your back-end business logic.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

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(); }

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date