Hi, This can be a little bit tricky. Not sure is there simpler way to achieve it, but I would try to manually create out message in exchange (like AbstractJAXWSMethodInvoker.createResponseMessage() does):
Exchange exchange = inMessage.getExchange(); Endpoint ep = exchange.get(Endpoint.class); outMessage = new MessageImpl(); outMessage.setExchange(exchange); outMessage = ep.getBinding().createMessage(outMessage); exchange.setOutMessage(outMessage); outMessage.setContent(...) and then abort the interceptor chain: InterceptorChain chain = message.getInterceptorChain(); chain.abort(); You can find similar behaviour in service routing sample: http://cxf.apache.org/docs/service-routing.html . In your case you should create and fill output message yourself. Regards, Andrei. > -----Original Message----- > From: Chauhan, Sumit K [mailto:[email protected]] > Sent: Freitag, 14. Juni 2013 12:10 > To: Andrei Shakirin; [email protected] > Subject: RE: CXF Custom Validation Interceptor with custom response not > working > > Yes, it is on service side. In case of invalid request, client will receive a > normal > response object, but with some modified parameters which needs to be set > as a part of interceptor. > > -----Original Message----- > From: Andrei Shakirin [mailto:[email protected]] > Sent: Friday, June 14, 2013 5:06 AM > To: [email protected] > Cc: Chauhan, Sumit K > Subject: RE: CXF Custom Validation Interceptor with custom response not > working > > Hi, > > I assume that interceptor validates request on the service side (not on the > client). > In request is invalid, should client receive normal response or SOAP Fault? > In case of SOAP Fault you can simply throw org.apache.cxf.interceptor.Fault > exception with desired data. > > Regards, > Andrei. > > > -----Original Message----- > > From: sumit_chauhan [mailto:[email protected]] > > Sent: Freitag, 14. Juni 2013 06:25 > > To: [email protected] > > Subject: CXF Custom Validation Interceptor with custom response not > > working > > > > I am trying to write a Custom CXF Interceptor to do some validations > > on SOAP request to a web service. Based on the validation results, I > > want to block the request to web service and return the response with > > some modified parameters. > > For this, I have written custom CXF ininterceptor extending from > > AbstractPhaseInterceptor, to run in phase USER_LOGICAL, which does > > validations, but I am not able to stop the subsequent call to web > > service and also not able to pass the Custom Response object(Custom > > Response object type is same as web service return type). > > I have also tried aborting the interceptor chain, but this does not > > return a response at all. > > How can I do this using interceptors? > > > > > > > > -- > > View this message in context: http://cxf.547215.n5.nabble.com/CXF- > > Custom-Validation-Interceptor-with-custom-response-not-working- > > tp5729251.html > > Sent from the cxf-user mailing list archive at Nabble.com. > > > This e-mail, including attachments, may include confidential and/or > proprietary information, and may be used only by the person or entity to > which it is addressed. If the reader of this e-mail is not the intended > recipient > or his or her authorized agent, the reader is hereby notified that any > dissemination, distribution or copying of this e-mail is prohibited. If you > have > received this e-mail in error, please notify the sender by replying to this > message and delete this e-mail immediately.
