Hi,
Thanx for your reply :)
BTW, I'm using Spring too, and I think maybe the problem relates to the
service implementor, which returns XChild instead of X! In fact, this part
is not covered in your sample test :S Actually i need inherited services to
return objects of different classes (which also extends X)! What do you
think?!
-- fatemeh
Arul Dhesiaseelan wrote:
>
> 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{
>> ......
>> }
>>
>>
>
>
>
>
--
View this message in context:
http://www.nabble.com/Service-Interface-Extension-in-CXF-tp18708779p18728166.html
Sent from the cxf-user mailing list archive at Nabble.com.