78
Designing a Service's Interaction Layer
...
Code Example 3.5
Generated WSDL for
WeatherService
Interface
Notice that the WSDL represents the
getWeather
overloaded methods as two
different SOAP messages, naming one
getWeather
, which takes an integer for the
zip code as its parameter, and the other
getWeather2
, which takes a string parame
ter for the city. As a result, a client interested in obtaining weather information
using a city name invokes the service by calling
getWeather2
, as shown in Code
Example 3.6.
...
Context ic = new InitialContext();
WeatherWebService weatherSvc = (WeatherWebService)
ic.lookup("java:comp/env/service/WeatherService");
WeatherServiceIntf port = (WeatherServiceIntf)
weatherSvc.getPort(WeatherServiceIntf.class);
String returnValue = port.getWeather2("San Francisco");
...
Code Example 3.6
Using Weather Service Interface with Java to WSDL Approach
<
New Page 1
Web Hosting Apache