Arul Dhesiaseelan wrote:
Hi,

I am getting an IllegalArgumentException (An operation with name [{http://example.com}getGroups] already exists in this service) when I have overloaded methods in my web service.

Is it not supported to have overloaded web service methods in JAX-WS?

I have the following methods:

public Groups getGroups();
public Groups getGroups(String pattern);

No, all the operations must have different names in the WSDL. If you are using CXF on both client and server side, you can do something like:

@WebMethod
public Groups getGroups();

@WebMethod(operationName = "getGroupsByPattern")
public Groups getGroups(String pattern);

This would give the two operations different names in the WSDL, but you can use the Java interface as the serviceClass of a JaxWsProxyFactoryBean and call both methods via their overloaded name.

Ian

P.S. If you were to generate code from the WSDL you would get public Groups getGroupsByPattern(String arg0), of course.

--
Ian Roberts               | Department of Computer Science
[EMAIL PROTECTED]  | University of Sheffield, UK

Reply via email to