/** * Trigger handleFault on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned {@code true}, in addition to the last interceptor who returned * {@code false}. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleFault(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleFault(messageContext)) { break; } } } }
/** * Trigger handleFault on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned {@code true}, in addition to the last interceptor who returned * {@code false}. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleFault(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleFault(messageContext)) { break; } } } }
/** * Trigger handleResponse on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned {@code true}, in addition to the last interceptor who returned * {@code false}. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleResponse(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleResponse(messageContext)) { break; } } } }
/** * Trigger handleFault on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned <code>true</code>, in addition to the last interceptor who returned * <code>false</code>. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleFault(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleFault(messageContext)) { break; } } } }
/** * Trigger handleFault on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned <code>true</code>, in addition to the last interceptor who returned * <code>false</code>. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleFault(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleFault(messageContext)) { break; } } } }
/** * Trigger handleResponse on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned {@code true}, in addition to the last interceptor who returned * {@code false}. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleResponse(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleResponse(messageContext)) { break; } } } }
/** * Trigger handleResponse on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned <code>true</code>, in addition to the last interceptor who returned * <code>false</code>. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleResponse(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleResponse(messageContext)) { break; } } } }
/** * Trigger handleResponse on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned <code>true</code>, in addition to the last interceptor who returned * <code>false</code>. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleResponse(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleResponse(messageContext)) { break; } } } }
/** * Trigger handleResponse on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned {@code true}, in addition to the last interceptor who returned * {@code false}. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleResponse(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleResponse(messageContext)) { break; } } } }
/** * Trigger handleFault on the defined ClientInterceptors. Will just invoke said method on all interceptors whose * handleRequest invocation returned {@code true}, in addition to the last interceptor who returned * {@code false}. * * @param interceptorIndex index of last interceptor that was called * @param messageContext the message context, whose request and response are filled * @see ClientInterceptor#handleResponse(MessageContext) * @see ClientInterceptor#handleFault(MessageContext) */ private void triggerHandleFault(int interceptorIndex, MessageContext messageContext) { if (messageContext.hasResponse() && interceptors != null) { for (int i = interceptorIndex; i >= 0; i--) { if (!interceptors[i].handleFault(messageContext)) { break; } } } }
public class MessageInterceptor extends EndpointInterceptor { private static final transient Logger log = LoggerFactory.getLogger(NCOssNinasAttachmentInterceptor.class); private SoapMessageFactory soapMessageFactory; @Autowired private NCOssNinasAttachmentInterceptor(SoapMessageFactory soapMessageFactory) { this.soapMessageFactory = soapMessageFactory; } @Override public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) throws Exception { SaajSoapMessage message = (SaajSoapMessage) messageContext.getResponse(); final OutputStream s = new ByteArrayOutputStream(); message.writeTo(s); log.info("SOAP RESPONSE: " + s.toString()); String modifiedMsg = faultCodeModifier(s.toString()); log.info("MODIFIED RESPONSE: " + modifiedMsg); final InputStream is1 = new ByteArrayInputStream(modifiedMsg.getBytes()); SoapMessage m = soapMessageFactory.createWebServiceMessage(is1); if (messageContext.hasResponse()) messageContext.clearResponse(); messageContext.setResponse(m); log.info("NEW RESPONSE WAS SET"); }
private void logResponse(MessageContext messageContext) throws IOException { if (messageContext.hasResponse()) { if (receivedMessageTracingLogger.isTraceEnabled()) { ByteArrayOutputStream requestStream = new ByteArrayOutputStream(); messageContext.getRequest().writeTo(requestStream); ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); messageContext.getResponse().writeTo(responseStream); receivedMessageTracingLogger .trace("Received response [" + responseStream.toString("UTF-8") + "] for request [" + requestStream.toString("UTF-8") + "]"); } else if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received response [" + messageContext.getResponse() + "] for request [" + messageContext.getRequest() + "]"); } } else { if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received no response for request [" + messageContext.getRequest() + "]"); } } }
private void logResponse(MessageContext messageContext) throws IOException { if (messageContext.hasResponse()) { if (receivedMessageTracingLogger.isTraceEnabled()) { ByteArrayOutputStream requestStream = new ByteArrayOutputStream(); messageContext.getRequest().writeTo(requestStream); ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); messageContext.getResponse().writeTo(responseStream); receivedMessageTracingLogger .trace("Received response [" + responseStream.toString("UTF-8") + "] for request [" + requestStream.toString("UTF-8") + "]"); } else if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received response [" + messageContext.getResponse() + "] for request [" + messageContext.getRequest() + "]"); } } else { if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received no response for request [" + messageContext.getRequest() + "]"); } } }
private void logResponse(MessageContext messageContext) throws IOException { if (messageContext.hasResponse()) { if (receivedMessageTracingLogger.isTraceEnabled()) { ByteArrayOutputStream requestStream = new ByteArrayOutputStream(); messageContext.getRequest().writeTo(requestStream); ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); messageContext.getResponse().writeTo(responseStream); receivedMessageTracingLogger .trace("Received response [" + responseStream.toString("UTF-8") + "] for request [" + requestStream.toString("UTF-8") + "]"); } else if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received response [" + messageContext.getResponse() + "] for request [" + messageContext.getRequest() + "]"); } } else { if (logger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received no response for request [" + messageContext.getRequest() + "]"); } } }
private void logResponse(MessageContext messageContext) throws IOException { if (messageContext.hasResponse()) { if (receivedMessageTracingLogger.isTraceEnabled()) { ByteArrayOutputStream requestStream = new ByteArrayOutputStream(); messageContext.getRequest().writeTo(requestStream); ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); messageContext.getResponse().writeTo(responseStream); receivedMessageTracingLogger .trace("Received response [" + responseStream.toString("UTF-8") + "] for request [" + requestStream.toString("UTF-8") + "]"); } else if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received response [" + messageContext.getResponse() + "] for request [" + messageContext.getRequest() + "]"); } } else { if (receivedMessageTracingLogger.isDebugEnabled()) { receivedMessageTracingLogger .debug("Received no response for request [" + messageContext.getRequest() + "]"); } } }
if (messageContext.hasResponse()) { WebServiceMessage response = messageContext.getResponse(); if (sentMessageTracingLogger.isTraceEnabled()) {
if (messageContext.hasResponse()) { WebServiceMessage response = messageContext.getResponse(); if (sentMessageTracingLogger.isTraceEnabled()) {
if (messageContext.hasResponse()) { WebServiceMessage response = messageContext.getResponse(); if (sentMessageTracingLogger.isTraceEnabled()) {
public void interceptRequest(MessageContext messageContext, WebServiceMessageReceiver messageReceiver) throws Exception { int interceptorIndex = -1; if (interceptors != null) { for (int i = 0; i < interceptors.length; i++) { interceptorIndex = i; if (!interceptors[i].handleRequest(messageContext)) { break; } } } // if an interceptor has set a response, we don't send/receive if (!messageContext.hasResponse()) { messageReceiver.receive(messageContext); } if (messageContext.hasResponse()) { if (!hasFault(messageContext.getResponse())) { triggerHandleResponse(interceptorIndex, messageContext); } else { triggerHandleFault(interceptorIndex, messageContext); } } }
/** * Logs response message from message context if any. SOAP messages get logged with envelope transformation * other messages with serialization. * * @param logMessage * @param messageContext * @param incoming * @throws TransformerException */ protected void logResponse(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException { if (messageContext.hasResponse()) { if (messageContext.getResponse() instanceof SoapMessage) { logSoapMessage(logMessage, (SoapMessage) messageContext.getResponse(), incoming); } else { logWebServiceMessage(logMessage, messageContext.getResponse(), incoming); } } }