Lab 8 - Java Web Services

In this lab you'll implement a Java Web Service that provides a facade for a stateless EJB Session Bean. More specifically the following example demonstrates: Part 1. Deploy and run the code example. The source code is in /stage/classes/current/51024-1/labs/lab8/myFirstWebService.tgz
Change to your directory:

~/weblogic/weblogic700/samples/server/src/examples/webservices/basic

Then execute this command:

tar xzvf /stage/classes/current/51024-1/labs/lab8/myFirstWebService.tgz

Setup:

cp /stage/classes/current/51024-1/labs/lab8/examples.properties ~/weblogic/weblogic700/samples/server/src

Then edit ~/weblogic/weblogic700/samples/server/src/examples.properties and change all instances of "skuehn" with YOUR
login id.

Then, in EVERY shell window in which you will be working, execute the weblogic environment setup:

. ~/weblogic/weblogic700/samples/server/config/examples/setExamplesEnv.sh

Steps:

  1. cd to the ~/weblogic/weblogic700/samples/server/src/examples/webservices/basic/myStatelessSession directory
  2. make sure you have your WebLogic server started
  3. Examine the EJB session bean closely
  4. Run the command:  "ant all" in the directory
  5. This will build the backend EJB Session Bean (this is essentially the WebLogic Trader example modified for use as a backend to a web service)
  6. cd to the ~/weblogic/weblogic700/samples/server/src/examples/webservices/basic/myFirstWebService directory
  7. Examine the Client.java code carefully.  This client will execute and hit your web service once it's built and deployed
  8. Examine the build.xml file carefully.  Examine the <target name="ear" > section carefully.  Notice that it calls the servicegen Ant task.  Examine that task carefully
  9. Execute "ant all" in the directory to create and deploy the web service
  10. Once the service is created, open the following URL to validate the deployment of your web service:

  11. http://localhost:7001/mywebservice/SampleEJBService
    You should see a page describing the two methods available on the service:  buy and sell
  12. In the MyFirstWebService directory, run the following command to validate execution:  "ant run"

  13. You should see several stock purchases and sales in the client window as well as in the stdout of the server
     


Assignment:  Wrap up your own Calculator Session bean created in Lab 6/Assignment 4 as a backend to a webservice.
(If you are not planning on using Web Services for your final project delivery, you may skip this assignment, as it is not required for your grade.  If, on the other hand, you are planning on implementing with Web Services, you will find this exercise useful).

Hints:

You will find WebLogic's Programming WebLogic Web Services helpful in terms of details.

Perhaps the best strategy for the assignment would be to copy the MyFirstWebService directory over to ../CalculatorWebService and modify the Client and build.xml to hit your Calculator EJB.