Chapter 3 Service Endpoint Design
79
For example, to obtain the weather information for San Francisco, the client
called
port.getWeather2( San Francisco )
. Keep in mind that another tool may
very likely generate a WSDL whose representation of overloaded methods is dif
ferent.
E
You may want to avoid using overloaded methods in your Java interface alto
gether if you prefer to have only intuitive method names in the WSDL.
If instead you choose to use the WSDL to Java approach, your WSDL
description might look as follows. (See Code Example 3.7.)
...
Code Example 3.7
WSDL for Weather Service with Overloaded Methods Avoided
Since the messages in a WSDL file must have unique names, you must use
different message names to represent methods that you would otherwise overload.
These different message names actually convert to different method calls in your
interface. Notice that the WSDL includes a method
getWeatherByZip
, which takes
an integer parameter, and a method
getWeatherByCity
, which takes a string
parameter. Thus, a client wishing to obtain weather information by city name from
<
New Page 1
Web Hosting Apache