i have a web service with Spring and jaxb and i try to throw one exception in some cases, for this I use the anotation @WebFault. just like this:
@WebFault
public class ServiceException extends Exception {
private static final long serialVersionUID = -5307754615848423430L;
private FaultBean faultBean;
public ServiceException(String message, ServiceErrorCode serviceErrorCode) {
super(message);
this.faultBean = new FaultBean();
this.faultBean.setMessage(message);
this.faultBean.setErrorCode(serviceErrorCode);
}
public FaultBean getFaultInfo() {
return faultBean;
}
}
and it's work fine, this is the output:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>myException</faultstring>
<detail>
<ns2:ServiceException xmlns:ns2="http://soap.service.test/">
<errorCode>UNRECOGNIZED_ERROR</errorCode>
<message>myException</message>
</ns2:ServiceException>
<ns2:exception class="ServiceException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" xmlns:ns2="http://jax-ws.dev.java.net/">
<message>myException</message>
<ns2:stackTrace>
<ns2:frame class="myWebService" file="myWebService.java" line="50" method="listTickets"/>
<ns2:frame class="sun.reflect.NativeMethodAccessorImpl" file="NativeMethodAccessorImpl.java" line="native" method="invoke0"/>
<ns2:frame class="sun.reflect.NativeMethodAccessorImpl" file="NativeMethodAccessorImpl.java" line="39" method="invoke"/>
<ns2:frame class="sun.reflect.DelegatingMethodAccessorImpl" file="DelegatingMethodAccessorImpl.java" line="25" method="invoke"/>
<ns2:frame class="java.lang.reflect.Method" file="Method.java" line="597" method="invoke"/>
<ns2:frame class="com.sun.xml.ws.api.server.InstanceResolver$1" file="InstanceResolver.java" line="246" method="invoke"/>
<ns2:frame class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java" line="146" method="invoke"/>
<ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandler" file="EndpointMethodHandler.java" line="257" method="invoke"/>
<ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="93" method="processRequest"/>
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="595" method="__doRun"/>
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="554" method="_doRun"/>
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="539" method="doRun"/>
...
so the problem is that does not seem correct show the stacktrace of the error, because the client does not care about those details, but can not find the way to do this, any ideas?