我正在使用Spring Boot(1.2.4.RELEASE)构建一个Web服务,我对这个框架很新.特别是,我正在尝试在抛出异常时自定义SoapFault内容(添加"detail"标记).
我按照这篇文章这样做:http://www.stevideter.com/2009/02/18/of-exceptionresolvers-and-xmlbeans/
这是我的例外:
package foo.bar.exception;
import org.springframework.ws.soap.server.endpoint.annotation.FaultCode;
import org.springframework.ws.soap.server.endpoint.annotation.SoapFault;
@SoapFault(faultCode = FaultCode.SERVER)
public class ServiceException extends Exception {
private static final long serialVersionUID = -1804604596179996724L;
private String tempFaultDetail;
public ServiceException(){
super("ServiceException");
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
public ServiceException(String message, Throwable cause, String fautDetail) {
super(message, cause);
setTempFaultDetail( fautDetail );
}
public String getTempFaultDetail() {
return tempFaultDetail;
}
public void setTempFaultDetail(String tempFaultDetail) {
this.tempFaultDetail …Run Code Online (Sandbox Code Playgroud)