Reputation: 6006
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?
Upvotes: 3
Views: 207
Reputation: 28762
I think you need to list both A
and B
as possible exceptions thrown from aa
, otherwise jaxb has no means to know that you might throw exceptions of derived classes. Try:
public void aa() throws A, B;
Upvotes: 2