String messageText = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+ "<soap:Header>"
+ "</soap:Header> "
+ "<soap:Body> "
+ "</soap:Body>"
+ "</soap:Envelope>";
Message message = new Message(messageText);
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(ostream);
os.writeObject(message);
ostream.flush();
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(ostream.toByteArray()));
Message m2 = (Message) ois.readObject();