[ https://issues.apache.org/jira/browse/CXF-2602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796829#action_12796829 ]
aaron pieper commented on CXF-2602: ----------------------------------- I'm not savvy enough to create an isolated test case, since this is more of an architectural problem rather than a problem with a single class. However, a simple scenario would be that a bad interceptor in the "Marshal" step writes a lot of garbage to the XMLStreamWriter - that garbage should be logged. Does that seem like a valuable test case to you? If I can find a bare bones CXF test case to start from, which creates a phase interceptor chain and a CXF message and does all the basic stuff, I can adapt that test case to illustrate what I'm talking about. One possible way for the LoggingOutInterceptor to be rearchitected, would be for it to replace the XmlStreamWriter, instead of replacing the OutputStream. If it did that, it could be moved late enough in the chain to capture any weirdness which occurrs in generating the SOAP envelope. Here's the full list of "snipped" things - most of the stuff in the "pre-stream" step is proprietary code, but you should get the idea. prepare-send [MessageSenderInterceptor, Soap11FaultOutInterceptor] pre-stream [MtomFaultForceInterceptor, ExceptionScrubber, FaultDetailInterceptor, XsltOutInterceptor420x, XsltOutInter ceptor411x, XsltOutInterceptor410x, LoggingOutInterceptor, StaxOutInterceptor] pre-protocol [WebFaultOutInterceptor, SOAPHandlerFaultOutInterceptor] write [SoapOutInterceptor] pre-marshal [LogicalHandlerFaultOutInterceptor] marshal [Soap11FaultOutInterceptorInternal] post-marshal [LogicalHandlerFaultOutEndingInterceptor] write-ending [SoapOutEndingInterceptor] pre-stream-ending [Compat420xXsltOutEndingInterceptor, StaxOutEndingInterceptor] prepare-send-ending [MessageSenderEndingInterceptor] > LoggingOutInterceptor does not always log the same SOAP envelope which is > returned from the service > --------------------------------------------------------------------------------------------------- > > Key: CXF-2602 > URL: https://issues.apache.org/jira/browse/CXF-2602 > Project: CXF > Issue Type: Improvement > Components: Core > Affects Versions: 2.2.2 > Reporter: aaron pieper > Priority: Minor > > I encountered a bug in my software, which was difficult to track down because > the LoggingOutInterceptor was not logging the SOAP envelope correctly. > Because the LoggingOutInterceptor is placed before several other CXF > components in the interceptor chain, it is possible for the logged SOAP > envelope to be different from what actually gets sent out. > More specifically, my phase interceptor chain looked like this: > -------------------- > pre-stream [(snip), LoggingOutInterceptor, StaxOutInterceptor] > pre-protocol [WebFaultOutInterceptor, SOAPHandlerFaultOutInterceptor] > write [SoapOutInterceptor] > pre-marshal [LogicalHandlerFaultOutInterceptor] > marshal [Soap11FaultOutInterceptorInternal] > post-marshal (snip) > -------------------- > There was a bug in the Soap11FaultOutInterceptorInternal, which was stripping > certain namespaces from the response; so that the returned Soap Envelope > looked like this: > -------------------- > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > <soap:Body> > <ns1:Fault > xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"> > <faultcode>ns2:Receiver</faultcode> > -------------------- > However, because the bug happened after the LoggingOutInterceptor, the > LoggingOutInterceptor logged a different Soap Envelope: > -------------------- > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > <soap:Body> > <ns1:Fault > xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"> > <faultcode > xmlns:ns2="http://www.w3.org/2003/05/soap-envelope">ns2:Receiver</faultcode> > -------------------- > So according to the LoggingOutInterceptor, we sending out valid XML - but in > fact, we were sending out invalid XML, since the "ns2" namespace in our > faultcode was being omitted. > I think the LoggingOutInterceptor should be as late in the phase interceptor > chain as possible, so that it would always log what we're sending back to the > user (minus any encryption.) It seems like this will require a rearchitecting > of the LoggingOutInterceptor (and possibly some other components as well.) > Hopefully these kinds of problems will be rare, so this disparity won't come > up often - so i think this is a low priority, but it would still be nice. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.