110
Lesson 4 Web Services Tutorial
Creating and using a JSP-based proxy client
After you create proxy code, you must write a proxy client that invokes the target web
service operations by instantiating a web service proxy object and calling its methods.
In the next procedures, you create a JSP-based proxy client by performing the following
steps:
1 Instantiate a proxy factory.
2 Instantiate a proxy.
3 Invoke a web service method.
To create a JSP-based proxy client:
1 Open the file jrun_root/servers/tutorial/travelnet-ear/travelnet-war/
home.jsp
. Add
the following code where indicated in the file:
// 1. Instantiate a proxy factory
TripService factory = new TripServiceLocator();
// 2. Instantiate a proxy
Trip trip = factory.getTrip();
// 3. Invoke the web service's getList() method
TripInfo[] trips = trip.getList();
int length = trips.length;
for (int i=0; i<length ; i++) {
%>
<tr>
<td class="contentBG"><a href="tripdetail.jsp?tripId=
<%= trips[i].getId() %>"><%= trips[i].getName() %></a></td>
<td class="contentBG"><%= trips[i].getTeaser() %></td>
<td class="contentBG"><%= trips[i].getPrice() %></td>
TripService
(ServiceName
.java)
A factory interface that the
ServiceNameLocator.java
class implements.
The interface name is derived from the service name in the
WSDL document.
TripServiceLocator
(
ServiceName
Locator.java)
A factory for obtaining proxy instances. It implements the
ServiceNameService.java interface. It is generated from
the service name in the WSDL file.
The class name is derived from the service name in the
WSDL document plus the suffix Locator. If you had more
than one service listed in the WSDL file, one class for each
service is generated. You use the
get
methods in this class
to get a stub object that implements the web service
interface.
TripSoapBindingStub
(ServiceBindingName
Stub.java)
The web service proxy class. It implements the
ServicePortName.java interface that uses the Axis client
API to make the web service call.
The class name is derived from the service binding name
plus the suffix Stub.
File
Description
Содержание 38000382 - Macromedia JRun - Mac
Страница 1: ...Getting Started with JRun...
Страница 16: ......
Страница 68: ...54 Chapter 5 Introduction to EJB...
Страница 82: ......
Страница 110: ...96 Lesson 3 EJB Tutorial...
Страница 128: ...114 Lesson 4 Web Services Tutorial...
Страница 132: ...118 Index...