I would like to implement method overloading in the Java web service class as follows:
public String myMethod(User user)
{
// My code
}
public String m
Overloading the web service methods is not difficult. With Axis 1.4 at least it is fairly simple. If there are two overloaded methods in the service like below:
public String myMethod(String firstName, String lastName) throws RemoteException
public String myMethod(String name) throws RemoteException
Then a request like this:
http://localhost:8080/services/testService?method=myMethod&name=<name>
will invoke the second method.
And a request like this one:
http://localhost:8080//services/testService?method=myMethod&firstName=<first_name>&lastName=<last_name>
will invoke the first method.
The resolution is done by Axis.
Operation overloading is not allowed for web services.
It is explicitely prohibited in WS-BP and WSDL 1.2 also disallows it.
Even if you found a stack that has some support for this I would recommend not to follow this approach.
Overloading is an OO
concept. Don't try to apply them to Service Oriented
paradigm