Ok. Object serialization in
Java produces a binary output. That binary output may or may not be valid content for an XML message even if it's inside a CDATA block. Now, to solve the need to be able to encode any kind of Java objects into the XML message, you could
1) Base64 encode the serialized bytes before injecting that into the XML and then Base64 decode the stuff you read from the XML before running them through an ObjectInputStream, or
2) Use an XML-to-Java serialization library such as XStream, Castor or Digester.