Suppose I have such exceptions hierarchy:
public class A extends RuntimeException {
...
}
public class B extends A {
...
}
In the web service interface there is a method:
public void aa() throws A;
Implementation of this method can throw either exception A or exception B, but while deploying to tomcat cxf publishes wsdl only with A exception declaration.
I have tried to use @XmlRootElement on both classes, @XmlType on both classes, @XmlRootElement on parent class, @XmlRootElement with @XmlSeeAlso on parent class, but published wsdl doesn’t have B exception declaration. Also I have written a test that uses that wsdl and test gets only A exception however I’ve emulated both types of exceptions. How can I get child exception in wsdl declaration?
I think you need to list both
AandBas possible exceptions thrown fromaa, otherwise jaxb has no means to know that you might throw exceptions of derived classes. Try: