[ https://issues.apache.org/jira/browse/CAMEL-8663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14530640#comment-14530640 ]
Akitoshi Yoshida commented on CAMEL-8663: ----------------------------------------- I think the xsi prefix in your example should not actually cause any problem when the StAXSource is correctly serialized (because it should find the namespace bound to prefix xsi and can serialize this attribute along with its namespace declrattion). If xsi's declaration disappears when converting to String, I think there is something wrong with the converter. But your example points out another issue, namely of handling the implicitly referenced prefixes (the prefix "xs" used in attribute value "xs:string"). To include this prefix declaration in the detached payload text, we need to collect the bindings from the envelope. I think the easiest way to do this is to make CXF provide this context map so that camel-cxf can directly inject it when instantiating CxfPayload. But in any case, the downside of including all implicitly referenced declarations is that they will be then included even when they are not even used. We might need to provide an option to not include additional declarations. I'll look into this. > Namespaces defined on the SOAP envelope get lost in PAYLOAD mode > ---------------------------------------------------------------- > > Key: CAMEL-8663 > URL: https://issues.apache.org/jira/browse/CAMEL-8663 > Project: Camel > Issue Type: Bug > Components: camel-cxf > Reporter: Stephan Siano > Attachments: > 0001-CAMEL-8663-Namespaces-defined-on-SOAP-envelope-lost-.patch > > > If a request message is send to a CXF consumer or a response is returned to > the CXF provider that contains namespace definions at the SOAP envelope and > the Camel-CXF endpoint is configured in PAYLOAD mode the namespace definition > gets lost unless streaming is disabled. > If the resulting CxfPayload is then converted e.g. to String that String will > contain invalid XML (because some namespace definition is missing). > For non-streaming mode (system property > org.apache.camel.component.cxf.streaming is set to false) there are special > precautions met to set these envelope namespaces on the first DOM element of > the payload but this coding is missing for StAX. > The messages in question look like that: > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <soap:Body> > <ns2:getTokenResponse xmlns:ns2="http://camel.apache.org/cxf/namespace"> > <return xsi:type="xs:string">Return Value</return> > </ns2:getTokenResponse> > </soap:Body> > </soap:Envelope> > If the CxfPayload is converted to String it will lack the definition for the > xsi namespace prefix (and further XML parsing will fail). -- This message was sent by Atlassian JIRA (v6.3.4#6332)