Chapter 3 Service Endpoint Design
77
3.4.1.4
Interfaces with Overloaded Methods
In your service interface, you may overload methods and expose them to the ser 
vice's clients. Overloaded methods share the same method name but have different
parameters and return values. If you do choose to use overloaded methods as part of
your service interface, keep in mind that there are some limitations, as follows:
  If you choose the WSDL to Java approach, there are limitations to represent 
ing overloaded methods in a WSDL description. In the WSDL description, 
each method call and its response are represented as unique SOAP messages. 
To represent overloaded methods, the WSDL description would have to sup 
port multiple SOAP messages with the same name. WSDL version 1.1 does 
not have this capability to support multiple messages with the same name. 
  If you choose the Java to WSDL approach and your service exposes overload 
ed methods, be sure to check how any vendor specific tools you are using rep 
resent these overloaded methods in the WSDL description. You need to ensure 
that the WSDL representation of overloaded methods works in the context of 
your application.
Let's see how this applies in the weather service scenario. As the provider,
you might offer the service to clients, letting them look up weather information by
city name or zip code. If you use the Java to WSDL approach, you might first
define the 
WeatherService
 interface as shown in Code Example 3.4.
public interface WeatherService extends Remote {
public String getWeather(String city) throws RemoteException;
public String getWeather(int zip) throws RemoteException;
}
Code Example 3.4
WeatherService
 Interface for Java to WSDL Approach
After you define the interface, you run the vendor provided tool to create the
WSDL from the interface. Each tool has its own way of representing the
getWeather
 overloaded methods in the WSDL, and your WSDL reflects the par 
ticular tool you use. For example, if you use the J2EE 1.4 SDK from Sun Micro 
systems, its 
wscompile
 tool creates from the 
WeatherService
 interface the WSDL
shown in Code Example 3.5.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

 

Our web partners: Inexpensive Web Hosting Java Web Hosting personal webspace webspace php  linux webhost

 html web templates DreamweaverQuality Web Templates PSD Web Templates

cheap webhost j2ee web Hosting buy webspace ftp webspace adult webspace

frontpage WebHosting webspace hosting cheap webhost

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved

webhosting