In this lab you will study some examples of Java Web Services. More specifically the following example demonstrates:
Configuration To use Weblogic examples you have to update some variables of your environment. Please do the following:
Part 1. Deploy and run a simple webservice example (jws_basic).
The source code for the first example is in $WL_HOME/samples/server/examples/src/examples/webservices/jws_basic/simple.
This example demonstrates a simple implementation of a webservice.
Read the instructions.html file. Study the source code. SimpleImpl.java constains the code to create the Web Service. Client.java is a command line client for the webservice implemented in SimpleImpl.java. Observe that no ejb-jar.xml file is used in this example. JWS annotations are used instead.
Detailed documentation on JWS programming can be found here.
Examine carefully the file build.xml. The targets "server" and "client" are the most important.
After deploying the web service files, you can go to http://your_machine:xxxx/jws_basic_simple/SimpleService, where your_machine is the name of the machine where you are running Weblogic and xxxx is the port (default 7001).
Part 2.
Now deploy and run the example in $WL_HOME/samples/server/examples/src/examples/webservices/jws_basic/complex. This example shows how to define WebMethods that use user-defined data types as parameters or return variable. In this case the user-defined data type is a class called BasicStruct.
Read the file instructions.html. Study the code. What is different from the previous example?. What changes were made in build.xml?
The last example shows a EJB client for a Web Service. The source code is in $WL_HOME/samples/server/examples/src/examples/webservices/jws_basic/ejbClient.
Read the file instructions.html. Study the source code. WSEJBClientBean.java shows a stateless session EJB that acts as a client for a Web Service. There are two xml files for this example. The usual build.xml file and a file build-ejbClient.xml that handles the operations related to the client compilation and deployment.
Assignment: Wrap up your own Calculator Session bean created
in previous assignments 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).
You will find WebLogic's Programming WebLogic Web Services helpful in terms of details.