-
1. Re: In OUT interceptor of a CXF provider, how can we stop the provider invoking its endpoint and send a response back?
lvisnick Sep 30, 2009 4:12 PM (in response to inalasuresh)Have you taken a look at the CXF interceptor demo under samples/configuration_interceptor?
if not, please use that as a starting point.
Tx,
Lorinda
-
2. Re: In OUT interceptor of a CXF provider, how can we stop the provider invoking its endpoint and send a response back?
ubhole Oct 1, 2009 5:17 AM (in response to inalasuresh)Hi Suresh,
you can interrupt CXF interceptor chain and install your own from your custom interceptor which will stop the invocation. However, you might have to be very careful about few interceptor that might need to be invoked for things like header filtering done for JAX-WS spec. compliance etc. You need to take into account such interceptor and handle them properly in your own interceptor chain. Same is true for some servicemix interceptors in the chain which may be managing normalized message exchange and such things. In your case simple thing I can think of if you want to stop invocation for all request is to add internal CXF-SE SU which will internally accept the requests and return response. It is a proper invocation but atleast would not mess around with the interceptor chain.
Regards,
Ulhas Bhole
-
3. Re: In OUT interceptor of a CXF provider, how can we stop the provider invoking its endpoint and send a response back?
dkulp_dkulp Oct 1, 2009 9:27 AM (in response to inalasuresh)This was also asked on the cxf users list and I responded there:
-
4. Re: In OUT interceptor of a CXF provider, how can we stop the provider invoking its endpoint and send a response back?
inalasuresh Oct 15, 2009 2:56 AM (in response to dkulp_dkulp)Hi Every one,
As of your suggesions i am using the 2nd option.
in this i am able to get the response with the hard coded value like (String xml = "<s12:Envelope> ...</s12:Envelope>).
Example code given below.
-
message (Message msgContext){
MessageImpl messageImpl = new MessageImpl();
Exchange exchange = msgContext.getExchange();
exchange.setInMessage(messageImpl);
messageImpl.setExchange(exchange);
//byte[] theByteArray = xml.getBytes();
//messageImpl.setContent(InputStream.class , new ByteArrayInputStream(theByteArray));
messageImpl.setContent(InputStream.class , new ByteArrayInputStream(context.getMessageBytes()));
messageImpl.put(PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID,BaseCXFLiteInterceptor.class.getName());
Conduit conduit = exchange.getConduit(messageImpl);
((AbstractConduit)conduit).getMessageObserver().onMessage(exchange.getInMessage());
}
but while response time i am getting following exception. how could i overcome/solve this issue.
Service mix Console
-
WARN - PhaseInterceptorChain - Interceptor has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: "http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper", the namespace on the "message" element, i
s not a valid SOAP version.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:102)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:58)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
at org.apache.servicemix.cxfbc.CxfBcConsumer$JbiChainInitiationObserver.onMessage(CxfBcConsumer.java:644)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:266)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:828)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
WARN - PhaseInterceptorChain - Interceptor has thrown exception, unwinding now
org.apache.servicemix.cxfbc.interceptors.JbiFault: Fault occured
at org.apache.servicemix.cxfbc.CxfBcConsumer$JbiPostInvokerInterceptor.handleMessage(CxfBcConsumer.java:791)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
at org.apache.servicemix.cxfbc.CxfBcConsumer$JbiChainInitiationObserver.onMessage(CxfBcConsumer.java:644)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:266)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:741)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
Thanks & Regards
Suresh