We have a Web Service implementation that throws a custom SecurityException
.
public class SecurityException extends Exception {
The service is then transformed into a wsdl using the maven plugin java2ws
. The resulting .wsdl file contains
<xs:element name="SecurityException" type="tns:SecurityException"/>
<xs:complexType name="SecurityException">
...
<wsdl:message name="SecurityException">
<wsdl:part name="SecurityException" element="tns:SecurityException">
</wsdl:part>
</wsdl:message>
Now if I run wsdl2java
on the .wsdl file I get a SecurityException file:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SecurityException")
public class SecurityException {
}
and a SecurityException_Exception file:
@WebFault(name = "SecurityException", targetNamespace = "http://service...../")
public class SecurityException_Exception extends Exception {
private ....SecurityException securityException;
public SecurityException_Exception() {
super();
}
public SecurityException_Exception(String message) {
super(message);
}
public SecurityException_Exception(String message, Throwable cause) {
super(message, cause);
}
public SecurityException_Exception(String message, ....SecurityException securityException) {
super(message);
this.securityException = securityException;
}
public SecurityException_Exception(String message, ....SecurityException securityException, Throwable cause) {
super(message, cause);
this.securityException = securityException;
}
public ....SecurityException getFaultInfo() {
return this.securityException;
}
}
How can I avoid the unneccessairy class? Why is it even generated? Why can't it just recreate the old class?
SecurityException extends Exception
(we're using cxf version 2.5 so the <2.3 bug with superclasses that I found googleing doesn't seem to apply)