Chapter 6. Web Services 165
12.Enter the package name com.itso.flightInfo and click Finish.
13.Select the package just created, right-click. From the pop-up menu select
New →Interface.
14.Enter the name FlightInfoWebService and click Finish.
15.Into the FlightInfoWebService.java window that opens, copy the following:
public boolean init(String[] keys, String[] elements);
public String getFlightInfo(String flight);
16.Save the file.
With the next few steps, we generate the Web Service client to the server side
Web Service. See Appendix C, “Sample server-side Web Service” on page 375
on building a Web Service.
See the Additional Materials appendix for instructions on how to download a
sample version of the server side Web Service. To complete the next few steps,
you can run that service side Web Service locally.
Tip: To help remove unresolved compiler errors, right-click in the source and
select Source → Organize Imports.
Attention: Before completing the next section, make sure the server-side
Web Service is running. Open a browser and point it to:
http://webservice_host:9080/DelayedFlightsWS/services/DelayedFlights/wsdl/
DelayedFlights.wsdl
In this example, webservice_host is the host name of your Web Service host,
and 9080 is the real port on which the service is running.
The browser should show the wsdl for the Web Service.
Note: If you will not be running the sample program with a real Web Service
server, you can skip some steps and you will need to comment out some code
in the local Web Service that calls the server-side web service.
Skip steps 17 and 18, the generation of the local client stub to the remote web
service.
In step 21, comment out the reference to the private
DelayedFlightsSoap_Stub stub that was not generated in steps 17 and 18.
Also comment out any code that uses this stub.