This is likely already fixed with the 2.5.0-SNAPSHOT as we now pull the
XMLStreamReader directly out of the StaxSource and use that. Fixed that a
couple days ago. Prior to that, we treated the StaxSource as a SAXSource and
set a ContentHandler on it and called parse. ContentHandlers cannot handle
comments. We didn't set a separate LexicalHandler on the SAXSource which
can. I'm testing some code with that now, but its likely not even needed
anymore.
Dan
On Thursday, October 20, 2011 1:18:07 PM Andrei Shakirin wrote:
> Hi,
>
> I see a following effect by using Dispatch interface:
>
> QName serviceName = new QName("http://org.apache.cxf",
> "stockQuoteReporter");
> Service s = Service.create(serviceName);
> QName portName = new QName("http://org.apache.cxf",
> "stockQuoteReporterPort");
> s.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
> "http://localhost:8080/sbb/services/Invoke"); Dispatch<SAXSource> dispatch
> = s.createDispatch(portName, SAXSource.class, Service.Mode.MESSAGE); try {
> FileInputStream fis = new
> FileInputStream("c:/1/request.xml"); XMLStreamReader request =
> XMLInputFactory.newInstance().createXMLStreamReader(fis); SAXSource
> response = dispatch.invoke(new StaxSource(request));
> System.out.println(response);
> } catch
> ...
>
> }
> File request.xml contains XML comments in body. As far as I send using this
> code, comments are removed from request and don't arrive provider. If I use
> StreamSource with input stream for Dispatch<> comments are preserved. Does
> it work as designed?
>
> Regards,
> Andrei.
--
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com