Factorize serialize/deserialize soap methods

Add tests