[ https://issues.apache.org/jira/browse/CXF-6319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14381751#comment-14381751 ]
Alessio Soldano edited comment on CXF-6319 at 3/26/15 11:38 AM: ---------------------------------------------------------------- I've had a preliminary look at the issue here. The problem seems to come from the fact that the the namespace 'xs' in the message above is declared in the body element and the SOAPBody of the message is built in SAAJInterceptor from a stax stream that points to the first element after the body. The elements before and up to the body are consumed from the stream when looking for soap headers in the ReadHeadersInterceptor, which is where the CXF-5891 optimization took place. Now, if there's no soap header and hence CXF-5891 causes no DOM content to be created during headers scan, namespace declarations in body and envelope elements (e.g. the only possible parents of body content elements) are lost. The SAAJInterceptor has a hack for copying the contents of the DOM created by ReadHeadersInterceptor into the SOAPPart that will contain the SOAPBody to be created later; this of course is of no use if no DOM was created in ReadHeadersInterceptor as no soap headers were detected. I'll likely fix this by explicitly keeping track of the namespace declarations found in envelope and body elements and applying them on the SOAPPart in SAAJInInterceptor. was (Author: asoldano): I've had a preliminary look at the issue here. The problem seems to come from the fact that the the namespace 'xs' in the message above is declared in the body element and the SOAPBody of the message is built in SAAJInterceptor from a stax stream that points to the first element after the body. The elements before and up to the body are consumed from the stream when looking for soap headers in the ReadHeadersInterceptor, which is where the CXF-5891 optimization took place. Now, if there's no soap header and hence CXF-5891 causes no DOM content to be created during headers scan, namespace declarations in body and envelope elements (e.g. the only possible parents of body content elements) are lost. The SAAJInterceptor has a hack for copying the contents of the DOM created by ReadHeadersInterceptor into the SOAPPart that will contain the SOAPBody to be created later; this of course is of no use if no DOM was created in ReadHeadersInterceptor as no soap headers were detected. I'll likely fix this by explicitly storing namespace declarations in envelope and body elements and applying them on the SOAPPart in SAAJInInterceptor. > Regression: failing namespace resolution after CXF-5891 > ------------------------------------------------------- > > Key: CXF-6319 > URL: https://issues.apache.org/jira/browse/CXF-6319 > Project: CXF > Issue Type: Bug > Components: JAX-WS Runtime > Affects Versions: 2.7.14, 2.7.15 > Reporter: mustafa > > When using CXF 2.7.14 or later this request fails > {code:xml} > <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <SOAP-ENV:Body xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <ns0:echo xmlns:ns0="http://example.com"> > <ns0:s xsi:type="xs:string">hello</ns0:s> > </ns0:echo> > </SOAP-ENV:Body> > </SOAP-ENV:Envelope> > {code} > with the error > {code:xml} > <Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > <SOAP-ENV:Header > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/> > <soap:Body> > <soap:Fault> > <faultcode>soap:Server</faultcode> > <faultstring>prefix xs is not bound to a namespace</faultstring> > </soap:Fault> > </soap:Body> > </soap:Envelope> > {code} > Prior to the changes for CXF-5891 this worked without any problems. Analysis > from Red Hat engineering seems to say that it looks that all attributes and > namespace settings in soap:envelop or soap:body elements are all ignored in > ReadHeaderInterceptor and SAAJInInterceptor. -- This message was sent by Atlassian JIRA (v6.3.4#6332)