Basically, you override base interface method in ChildServiceInterface. So, this should work by all means.

I know for sure this works standalone CXF. I haven't tested in a servlet container.

Here is my standalone test, in case if you are interested.

public interface ParentServiceInterface { public String[] getXList();
}

@WebService
public interface ChildServiceInterface extends ParentServiceInterface{
      @WebMethod
      public String[] getXList();
}

public class ChildServiceImpl implements ChildServiceInterface {
      public String[] getXList(){
           return new String[] {"child"};
      }
}

public class Server {
 public static void main(String args[]) {
   System.out.println("Starting Server");
   ChildServiceImpl implementor = new ChildServiceImpl();
   String address = "http://localhost:9000/child";;
Endpoint.publish(address, implementor); }
}

public class Client {
 public static void main(String args[]) {
   JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
   factory.setServiceClass(ChildServiceInterface.class);
   factory.setAddress("http://localhost:9000/child";);

   ChildServiceInterface client = (ChildServiceInterface)factory.create();
   System.out.println("Invoke getXList()....");
   System.out.println(client.getXList()[0]);
   System.exit(0);

 }
}

HTH.

Cheers,
Arul

Fatemeh Chitforoush wrote:
Hi,

Does CXF support inheritance in service interfaces?
I want to have a common interface for a number of services, so I have a
parent interface, and all my service interfaces extend this parent
interface. When i try to fire up tomcat, this exception is thrown:
An opration  "an operation with name [] already exists in this service.
Does CXF support what I want?

Sample code:
public interface ParentServiceInterface {
      public X[] getXList();
}

public interface ChildServiceInterface extends ParentServiceInterface{
@WebMethod public X[] getXList();
}

public class ChildServiceImpl implements ChildServiceInterface {
       public XChild[] getXList(){
            .......
       }
}

public class XChild extends X{
......
}



Reply via email to