SOAPHandlerInterceptor handleMessage should be a no-op if no protocol handlers
are registered.
----------------------------------------------------------------------------------------------
Key: CXF-245
URL: http://issues.apache.org/jira/browse/CXF-245
Project: CXF
Issue Type: Improvement
Components: JAX-WS Runtime
Reporter: Andrea Smyth
Use this in SOAPHandlerInterceptor.handleMessage():
HandlerChainInvoker invoker = getInvoker(message);
if (invoker.getProtocolHandlers().isEmpty()) {
return;
}
thus only manipulating the streams if absolutely necessary.
More importantly, we should ensure that the execution path is the same (aside
from the invocation of the JAXWS procotol handlers) regardless how many JAXWS
protocol handlers are installed.
At the moment this is NOT the case:
To verify, apply the above change to a working copy. and run the addressing
system test (MAPTest), with logging in the Server enabled (level >= INFO). The
test passes, but
you'll notice that - with the above change - an exception is thrown by the
server when processing the partial response to greetMeOneWay :
16-Nov-2006 13:59:47 org.apache.cxf.transport.http.JettyHTTPDestination
flushHeaders
WARNING: Response object is null
16-Nov-2006 13:59:47 org.apache.cxf.common.logging.LogUtils log
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not write to XMLStreamWriter.
at
org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:94)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:57)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
at
org.apache.cxf.ws.addressing.ContextUtils.rebaseResponse(ContextUtils.java:349)
at
org.apache.cxf.ws.addressing.MAPAggregator.mediate(MAPAggregator.java:183)
at
org.apache.cxf.ws.addressing.MAPAggregator.handleMessage(MAPAggregator.java:89)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:64)
at
org.apache.cxf.transport.http.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:286)
at
org.apache.cxf.transport.http.JettyHTTPDestination.doService(JettyHTTPDestination.java:259)
at
org.apache.cxf.transport.http.JettyHTTPDestination$2.handle(JettyHTTPDestination.java:119)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: com.ctc.wstx.exc.WstxIOException: Response object is null
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1605)
at com.ctc.wstx.sw.BaseStreamWriter.close(BaseStreamWriter.java:246)
at
org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:83)
... 20 more
Caused by: java.io.IOException: Response object is null
at
org.apache.cxf.transport.http.JettyHTTPDestination.flushHeaders(JettyHTTPDestination.java:332)
at
org.apache.cxf.transport.http.JettyHTTPDestination$WrappedOutputStream.doFlush(JettyHTTPDestination.java:421)
at
org.apache.cxf.io.AbstractCachedOutputStream.flush(AbstractCachedOutputStream.java:87)
at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:92)
at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:184)
at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:165)
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1603)
... 22 more
16-Nov-2006 13:59:47 org.apache.cxf.ws.addressing.ContextUtils rebaseResponse
WARNING: SERVER_TRANSPORT_REBASE_FAILURE_MSG
org.apache.cxf.interceptor.Fault: Could not write to XMLStreamWriter.
at
org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:94)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:57)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
at
org.apache.cxf.ws.addressing.ContextUtils.rebaseResponse(ContextUtils.java:349)
at
org.apache.cxf.ws.addressing.MAPAggregator.mediate(MAPAggregator.java:183)
at
org.apache.cxf.ws.addressing.MAPAggregator.handleMessage(MAPAggregator.java:89)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:64)
at
org.apache.cxf.transport.http.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:286)
at
org.apache.cxf.transport.http.JettyHTTPDestination.doService(JettyHTTPDestination.java:259)
at
org.apache.cxf.transport.http.JettyHTTPDestination$2.handle(JettyHTTPDestination.java:119)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: com.ctc.wstx.exc.WstxIOException: Response object is null
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1605)
at com.ctc.wstx.sw.BaseStreamWriter.close(BaseStreamWriter.java:246)
at
org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:83)
... 20 more
Caused by: java.io.IOException: Response object is null
at
org.apache.cxf.transport.http.JettyHTTPDestination.flushHeaders(JettyHTTPDestination.java:332)
at
org.apache.cxf.transport.http.JettyHTTPDestination$WrappedOutputStream.doFlush(JettyHTTPDestination.java:421)
at
org.apache.cxf.io.AbstractCachedOutputStream.flush(AbstractCachedOutputStream.java:87)
at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:92)
at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:184)
at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:165)
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1603)
... 22 more
Without the change, the server flushes the partial response only once.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira