Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
if there is "whitespace" after <soap:Body> tag in the response soap message of cxf bc provider
then get exception
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:732)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:618)
at org.apache.servicemix.cxfbc.interceptors.JbiInWsdl1Interceptor.getBodyElement(JbiInWsdl1Interceptor.java:317)
at org.apache.servicemix.cxfbc.interceptors.JbiInWsdl1Interceptor.handleMessage(JbiInWsdl1Interceptor.java:153)
at org.apache.servicemix.cxfbc.interceptors.JbiInWsdl1Interceptor.handleMessage(JbiInWsdl1Interceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
at org.apache.servicemix.cxfbc.CxfBcProviderMessageObserver.onMessage(CxfBcProviderMessageObserver.java:139)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2029)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1907)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1832)
at org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:228)
at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:540)
at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:492)
at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
That's because in the ReadHeadersInterceptor the XmlStreamReader only advance to just outside the <soap:body> opening tag, but left the whitespace, see the comment there
//advance to just outside the <soap:body> opening tag, but not
//to the nextTag as that may skip over white space that is
//important to keep for ws-security signature digests and stuff
So in the JbiInWsdl1Interceptor we need ensure the whitespace is parsed before try to read the body content.