Is there a way to enforce CDATA usage on a web service client.
What is the best way to handle to values in the web service client payloads which contain special characters. Is there a way we can achieve this in a generic manner and applies to all potential webservice clients.
If you're using XML as the web service payload, then you'll certainly want to escape ampersands in text correctly. However it's unnecessary to use CDATA to do that, so there shouldn't be any reason to require the use of CDATA.
So in other words the generic thing to do is to produce well-formed XML. There isn't any problem with using ampersands in web services (it happens every day where I work).
The alternative is to simply escape the ampersand correctly in an ordinary text node. Any competent piece of XML software will do that automatically when you serialize a document; did you write your own serializer?
You're asking on behalf of your clients who send you malformed XML? The advice to them is the same as to you: Don't do that. Use competent XML-handling software. You can't repair malformed XML, if that's your question.
I interpreted your response on "did you write your own serializer" as client side activity to serialize java to xml
On the server side I use Apache CXF framework web services. I did not write any specific serializer.
I am not understanding where can I intersperse the check and fix to make the xml payload well-formed received as part of the request