Tuesday, September 2, 2008
Creating & Testing EJB3 Web Services with IBM Rational IRAD 7.5 for WebSphere
So, I'm playing with IRAD 7.5 Beta, and I'm testing the tools ability to create a Web Service out of a simple Stateless Session Bean (SLSB). In theory, creating it should be as easy as simply decorating the EJB with the @WebService annotation and deploying it, so that's what I did.
Now, I did see a Wizard that said Web Services --> Create Web Services, so I figured I'd give it a try. However, a huge wizard came up, and it looked like it was the same old wizard from before. I created a web service based on a FooEJB, but the IRAD 7.5 beta tool didn't actually decorate my version 3 EJB with @WebService annotations, so I knew that whatever it was doing, it was doing it the old way, not the new way. Still, I let the wizard run. The good thing about the wizard is that it brings up a whole Web Service test environment, and I figured that'd be good, just to see the URL that WebSphere creates for the test Web Service.
So, I deployed my project with the Wizard created Web Service, along with my annotated @WebService EJB. The Web Service test window came up, and the Web Service created by the tool seemed to work.
Now, one thing I did before using the wizard was click on something called a Web Service Endpoint Enabler.
Anyways, under Services in my EJB module, the web service created with the wizard was listed, so I right clicked and selected "Test with Web Service Explorer." The wizard created WS worked!
So, I dug around, and somehow, under WebSphere Web Service WSDL documents, a link to my EJB3.0 @WebService was listed. I clicked GO, and then tested my HelloWorld method, and lo and behold, it worked!
I must say, I was pretty impressed! Good job, IBM!
****************************************************
package com.mcnz.ejb;
import javax.ejb.Stateless;
import javax.jws.WebService;
@Stateless
@WebService
public class StatelessTimerBean implements StatelessTimerLocal {
public StatelessTimerBean() {
}
public String helloWorld() {
return "Hello World";
}
}
*** ********** **** ********** * ******** **** ******* ****
package com.mcnz.ejb;
import javax.ejb.Local;
@Local
public interface StatelessTimerLocal {
String helloWorld();
}
****************************************************
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment