It's not a problem with the parser configuration, but a bug in the implementation of the getElementText method of the XMLStreamReader returned by getXMLStreamReaderWithoutCaching. This is fixed by https://github.com/apache/ws-axiom/commit/f8eb657ee0c9ee0fd4754ccdc6c96da20dc6de4d .
Andreas On Fri, Nov 19, 2021 at 5:06 PM joey fedor <joeyfe...@gmail.com> wrote: > Hi, > > Ignore this if it is a duplicate, It seemed to be undeliverable on my > other email. > > Recently we updated AXIS2 from version 1.7.9 to version 1.8.0. After > running our server we quickly found some adverse behavior from the update. > Our clients will send a soap envelope to the server with several fields. If > one of these fields is wrapped in a CDATA tag it gets parsed as an empty > string. > > > *For example:* > <soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/ > xmlns:web=http://testsite.partner.inbound> > <soapenv:Header/> > <soapenv:Body> > <web:upload> > > <!--Optional:--> > <web:username>username</web:username> > > <!--Optional:--> > <web:password>password</web:password> > > <!--Optional:--> > <web:data><![CDATA[TestCdata]]></web:data> > > </web:upload> > </soapenv:Body> > </soapenv:Envelope> > > > *Code generated using wsdl2java:* > XMLStreamReader parser = > root.getBody().getFirstElement().getXMLStreamReaderWithoutCaching(); > > Upload u = Upload.Factory.parse(parser); > > String username = u.getUsername()); > String password = u.getPassword()); > String data = u.getData()); > > > > *our expected results for each variable is:*username = “username” > password = “password” > data = “TestCdata” > > > *but we are getting the following:*username = “username” > password = “password” > data = “” > > After some digging this appears to be due to a change in the way that the > newer version of axiom handles preserving Cdata as well as its change in > default coalescing. I have been reading through the axiom userguide with > the recommendation of changing javax.xml.stream.isCoalescing=true (ive > tried false as well), but its seems to have no effect. > > Am I missing something here or is CDATA not something that Axis2 is able > to handle as of 1.8.0 ? > > Thank you, > Joey >