Hello again,

I would like some help with a client-side inbound interceptor. I am trying,
within an interceptor at phase PRE_PROTOCOL, to replace the received
response with a forged one. The forged response is a standard SOAPMessage.

I tried replacing the InMessage in the exchange, but it does not seem to
work: the former response is used instead of the forged one.


SOAPMessage response = // get the forged response somewhere

            //this.currentMessage.getInterceptorChain().abort();
            Endpoint e =
this.currentMessage.getExchange().get(Endpoint.class);
            if (!this.currentMessage.getExchange().isOneWay()) {
                Message responseMsg = new MessageImpl();
                responseMsg.setExchange(this.currentMessage.getExchange());
                responseMsg = e.getBinding().createMessage(responseMsg);
                this.currentMessage.getExchange().setInMessage(responseMsg);

                responseMsg.setContent(SOAPMessage.class, response);

                InterceptorChain chain = /*OutgoingChainInterceptor

 .getOutInterceptorChain(this.currentMessage.getExchange());*/
                        this.currentMessage.getInterceptorChain();
                responseMsg.setInterceptorChain(chain);
                /*chain.doInterceptStartingAfter(responseMsg,
                        SoapPreProtocolOutInterceptor.class.getName());*/
                logger.error("doIntercept() ON THE NEW RESPONSE");
                chain.doIntercept(responseMsg);
                logger.error("ABORT INTERCEPTION OF THE OLD RESPONSE");
                this.currentMessage.getInterceptorChain().abort();
                logger.error("ENDING...");
            }


Thank you for your help.
--
Marian MULLER
SERLI

Reply via email to