/** * Invokes this method endpoint with the given arguments. * * @param args the arguments * @return the invocation result * @throws Exception when the method invocation results in an exception */ public Object invoke(Object... args) throws Exception { Object endpoint = getBean(); ReflectionUtils.makeAccessible(method); try { return method.invoke(endpoint, args); } catch (InvocationTargetException ex) { handleInvocationTargetException(ex); throw new IllegalStateException( "Unexpected exception thrown by method - " + ex.getTargetException().getClass().getName() + ": " + ex.getTargetException().getMessage()); } }
/** * Invokes this method endpoint with the given arguments. * * @param args the arguments * @return the invocation result * @throws Exception when the method invocation results in an exception */ public Object invoke(Object... args) throws Exception { Object endpoint = getBean(); ReflectionUtils.makeAccessible(method); try { return method.invoke(endpoint, args); } catch (InvocationTargetException ex) { handleInvocationTargetException(ex); throw new IllegalStateException( "Unexpected exception thrown by method - " + ex.getTargetException().getClass().getName() + ": " + ex.getTargetException().getMessage()); } }
/** * Invokes this method endpoint with the given arguments. * * @param args the arguments * @return the invocation result * @throws Exception when the method invocation results in an exception */ public Object invoke(Object... args) throws Exception { Object endpoint = getBean(); ReflectionUtils.makeAccessible(method); try { return method.invoke(endpoint, args); } catch (InvocationTargetException ex) { handleInvocationTargetException(ex); throw new IllegalStateException( "Unexpected exception thrown by method - " + ex.getTargetException().getClass().getName() + ": " + ex.getTargetException().getMessage()); } }
/** * Default implementation that checks whether the given {@code endpoint} is in the set of {@link * #setMappedEndpoints mapped endpoints}. * * @see #resolveExceptionInternal(MessageContext,Object,Exception) */ @Override public final boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex) { Object mappedEndpoint = endpoint instanceof MethodEndpoint ? ((MethodEndpoint) endpoint).getBean() : endpoint; if (mappedEndpoints != null && !mappedEndpoints.contains(mappedEndpoint)) { return false; } // Log exception, both at debug log level and at warn level, if desired. if (logger.isDebugEnabled()) { logger.debug("Resolving exception from endpoint [" + endpoint + "]: " + ex); } logException(ex, messageContext); return resolveExceptionInternal(messageContext, endpoint, ex); }
/** * Default implementation that checks whether the given <code>endpoint</code> is in the set of {@link * #setMappedEndpoints mapped endpoints}. * * @see #resolveExceptionInternal(MessageContext,Object,Exception) */ public final boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex) { Object mappedEndpoint = endpoint instanceof MethodEndpoint ? ((MethodEndpoint) endpoint).getBean() : endpoint; if (mappedEndpoints != null && !mappedEndpoints.contains(mappedEndpoint)) { return false; } // Log exception, both at debug log level and at warn level, if desired. if (logger.isDebugEnabled()) { logger.debug("Resolving exception from endpoint [" + endpoint + "]: " + ex); } logException(ex, messageContext); return resolveExceptionInternal(messageContext, endpoint, ex); }
/** * Default implementation that checks whether the given {@code endpoint} is in the set of {@link * #setMappedEndpoints mapped endpoints}. * * @see #resolveExceptionInternal(MessageContext,Object,Exception) */ @Override public final boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex) { Object mappedEndpoint = endpoint instanceof MethodEndpoint ? ((MethodEndpoint) endpoint).getBean() : endpoint; if (mappedEndpoints != null && !mappedEndpoints.contains(mappedEndpoint)) { return false; } // Log exception, both at debug log level and at warn level, if desired. if (logger.isDebugEnabled()) { logger.debug("Resolving exception from endpoint [" + endpoint + "]: " + ex); } logException(ex, messageContext); return resolveExceptionInternal(messageContext, endpoint, ex); }
/** * Default implementation that checks whether the given {@code endpoint} is in the set of {@link * #setMappedEndpoints mapped endpoints}. * * @see #resolveExceptionInternal(MessageContext,Object,Exception) */ @Override public final boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex) { Object mappedEndpoint = endpoint instanceof MethodEndpoint ? ((MethodEndpoint) endpoint).getBean() : endpoint; if (mappedEndpoints != null && !mappedEndpoints.contains(mappedEndpoint)) { return false; } // Log exception, both at debug log level and at warn level, if desired. if (logger.isDebugEnabled()) { logger.debug("Resolving exception from endpoint [" + endpoint + "]: " + ex); } logException(ex, messageContext); return resolveExceptionInternal(messageContext, endpoint, ex); }
@Override protected final boolean resolveExceptionInternal(MessageContext messageContext, Object endpoint, Exception ex) { MethodEndpoint methodEndpoint = (MethodEndpoint)endpoint; if(methodEndpoint != null && methodEndpoint.getBean().getClass().getSimpleName().equalsIgnoreCase(getEndpointClass().getSimpleName())) { Assert.isInstanceOf(SoapMessage.class, messageContext.getResponse(), "SimpleSoapExceptionResolver requires a SoapMessage"); SoapMessage response = (SoapMessage) messageContext.getResponse(); String faultString = StringUtils.hasLength(ex.getMessage()) ? ex.getMessage() : ex.toString(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addServerOrReceiverFault(faultString, getLocale()); customizeFault(messageContext, endpoint, ex, fault); return true; } return false; }