I want to convert a SOAPMessage to a byte Array so i can encrypt it and then decrypt it in a proxy server that will make the Invoke of a Web service on my behalf.
The problem is that SOAPMessage does not implement java.io.Serializable and therefore I can't proceed on the encryption of it.
I have used this for serializing
public static byte[] serializeSoapMessage (SOAPMessage sm){
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        sm.writeTo(baos);
       byte[] bytes= baos.toByteArray();
       return bytes;
    } catch (SOAPException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}
But deserialization is a problem because ObjectInputStream requires the implementation of java.io.Serializable
Thank you in regards :)