jQuery in Action, 3rd edition
The moose likes Web Services and the fly likes JAX-WS: Always return String as CDATA. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS: Always return String as CDATA." Watch "JAX-WS: Always return String as CDATA." New topic

JAX-WS: Always return String as CDATA.

Oliver Naumann

Joined: Jul 29, 2013
Posts: 2
Hi guys,

I'm using JAX-WS in order to implement a web service. The web service receives XML as parameter and returns XML. I use Java Strings for this (i.e. the XML data comes as string and gets returned as a string):

Now when I return small XML instances (with few < and >), the String is not wrapped within CDATA but instead the < are parsed into <. However if the instances that are returned are big enough, suddenly my web service packs everything into a CDATA passage.
The latter is actually what I want: I want every string to be represented as a CDATA field. But my service won't return the short XML instances as CDATA. Is there any way to force JAX-WS to always return the string within a CDATA passage?
I agree. Here's the link: http://aspose.com/file-tools
subject: JAX-WS: Always return String as CDATA.
It's not a secret anymore!