Lesson 2: Creating the web service
In this lesson you will learn how to create the top-down Java™ address book web service from the WSDL file imported in the previous lesson.
Before you begin
Procedure
Results
Adding the business logic to the skeleton bean
About this task
The skeleton implementation bean generated by the web
service wizard AddressBookPortImpl.java does not
contain any business logic. It does contain the annotation @javax.jws.WebService which
tells the runtime that it is a JAX-WS web service.
In order to
make the address book web service function as expected, you need to
add code to this bean. It should be opened in an editor automatically after generating
the web service, but if not it can be found in: jwsAddressBook/Java
Resources/src/com.addressbook.
Procedure
Test the web service using the Generic Service Client
About this task
Procedure
-
Select the generated WSDL file
jwsAddressBook/WebContent/WEB-INF/wsdl/AddressBook.wsdl, right-click and select .Alternatively you can select the service under the project's Services node or the JAX-WS web services node in the Services view, and launch the Generic Service Client from there. -
Select the
SaveAddressoperation. - Enter values in each of the fields and click Invoke.
-
Select the
FindAddressoperation. - Enter the name you chose when invoking the saveAddress operation and click Invoke.
- The information you saved to this name will display in the Status pane.
Lesson Checkpoint
Now you are ready to begin Lesson 3: Creating the web service client .