Is it possible to use Jax-WS with a Generic interface?
Asked Answered
R

0

1

How to use a generic common Interface for Jax-WS ?

public interface IGenericWebService<T extends Record> {
    @WebMethod
    public List<T> listAll();      
}

how to make it works without overriding the method ?

@WebService
public interface IWCustomerService extends IGenericWebService<Customer>{
    /* 
    @WebMethod  
    public List<Customer> listAll(); */
}

Common implementation

public abstract class GenericWebService<T extends Record> implements IGenericWebService<T>{
    protected static Log log = LogFactory.getLog(GenericWebService.class);
}

Customer Service

@WebService(endpointInterface="com.dev.bridge.iwservices.IWCustomerService")
@Service
public class WCustomerService extends GenericWebService<Customer> implements IWCustomerService{
    @Autowired
    private ICustomerService customerService;
    public List<Customer> listAll() {
        try {
            return customerService.listAll();           
        } catch (CoreException e) {
            log.error(e.getMessage(), e);
        }
        return new ArrayList<Customer>();
    }
}
Repartee answered 18/6, 2015 at 7:7 Comment(2)
How it should works without method body?Delilahdelimit
Of corse there is an implementationRepartee

© 2022 - 2024 — McMap. All rights reserved.