Tutorial : Building EJB3 Stateless Session Bean and JAX-WS web service In One Class Using RAD 7.5 - Developing JAX-WS Client

This series is about building an empty shell application that contains an EJB3 stateless session bean, a JAX-WS web service, and a web application that acts as the EJB and web service clients. I personally built it for performance testing purpose; so I can plug-in "in-doubt" java code to oberve how they handle concurrency in a server environment. But this will serve as a tutorial for those who are interested.

Part 1 : Project Setup
Part 2 : EJB3 and JAX-WS Implementation
Part 3 : Develop EJB3 client
Part 4 : Develop JAX-WS client


Generate JAX-WS client code

From Java EE perspective, expand Services from the EJB/JAX-WS project TestHarness. Right click the service, select Generate -> Client.


Accept Default, Click Next.


Make sure the output folder is the Client web project. If not, you will have to copy generated classes over. 


Review what is generated. Under src are generated client classes and under WEB-INF/wsdl are generated wsdl files.



Develop Jax-WS client servlet

Create a servlet called TestJAXWSClientServlet.



Change Jax-WS web service endpoint

Open the wsdl file generated under WEB-INF/wsdl.


 Replace "REPLACE_WITH_ACTUAL_URL"   with the actual url, in my case, http://localhost:9081/TestHarness_HTTPRouter/TestHarnessService

Test

Now we are done. Deploy the application to WebSphere Application Server and test it.

http://localhost:9081/TestHarnessWeb/TestJAXWSClientServlet
http://localhost:9081/TestHarnessWeb/TestEJBClientServlet

No comments:

Post a Comment