In the layer below Web-Service Layeryou need to create your own Exception, and in Web-Service Layeryou should use the approach try-catchto achieve occurred exceptionboth catchblock logand convert it to your custom web service level exception. I show this approach as follows:
@WebService
public class EmployeeWS
{
@WebMethod
public void add(Employee em) throws CustomWebServiceException
{
try
{
}
catch(Exception e)
{
logger.error(e.getMessage());
throw new CustomWebServiceException(e);
}
}
}
, try catch Web-Method, AOP approch ( Spring AOP) interceptor Web-Service frameworks ( SOAPHandler<T> JAX-WS).
. JAX-WS throw a RuntimeException, Exception WSDL, throw a RuntimeException - CustomException, Web-Method .
Web-Service faramework.